-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kgn/logging revamp #2720
Kgn/logging revamp #2720
Conversation
I do like the idea. @lexelby what do you think? |
I like the idea of centralizing everything. I wonder if we should go even further by changing lib/debug.py to use the logging system too? Right now it just prints to the log file. With the addition of another |
Some improvements:
There are also template files for DEBUG and LOGGING. Additionally, please ensure to test thoroughly before deployment. |
Thank you for all the work you've done! |
I tried to perform a rebase, but it seems like it's doing a merge instead. It transferred commits from the main branch to this branch. I'm not clear on how it works either. |
Make sure your local main branch is up to date. Then you checkout into your branch and type |
8d5eea2
to
ff3bfb1
Compare
Now it's exactly as it should be, thank you. |
Just a few minor comments, but this is looking really good! |
Another attempt. |
4a7fcd1
to
68cad69
Compare
68cad69
to
c08f460
Compare
Another attempt without AI. |
731316f
to
a36844d
Compare
Since the "print pdf revert to browser" branch has been merged this PR has conflicts in the print_pdf file. Sorry for the trouble. |
a36844d
to
a86cc29
Compare
Thank you for letting me know about the conflicts. Of course, feel free to perform any updates at any time. I'll be happy to assist. |
Thanks for the update! I rather leave the review to @lexelby. |
a86cc29
to
65df099
Compare
Is there anything else that needs to be addressed or any issues with the TOML format? |
I did some merging and again there is a merge conflict for this branch (sorry for that) |
65df099
to
10505f2
Compare
Thank you for the information. At least I got to try the rebase when the file is removed. Hopefully, I did it correctly. I'm still not entirely sure if everything went smoothly, but fingers crossed. |
Thank you so much. Ink/Stitch is a good learning field - at least it has been for me (and still is). |
Thank you very much for the review. I hope the modifications will be beneficial. |
Attempt to centralize logging and warning settings, along with their configuration, from an external file.
Some ideas can be found in: Modern Python logging
root logger:
logging.xxx()
calls.logging.disable()
and channel all warnings to loggingby setting
logging.captureWarnings(True)
with the levelWARNING
.logging.config.dictConfig(logging_dict)
.module logger:
logger=getLogger(name)
.Avoid using
__name__
as the name, as it generates numerous loggers per application.The logger name persists globally throughout the application.
instead, utilize the top-level application configuration with
logging.config
.This allows users of the application to customize it according to their requirements.
suggested usage of module logger:
Current status
When running inkstitch as frozen mode normally we want to ignore all warnings and logging, but we can enable it by setting environment variables before
inkscape
is started:input-svg-file.inkstitch.log
When running in development mode we want to use configuration from some
LOGGING.toml
file:DEBUG.ini
,log_config_file=LOGGING.toml
LOGGING_template.toml
andDEBUG_template.ini
.debug_logging.py
contains default setting for logging system if the configuration file is missing.why TOML format