-
Notifications
You must be signed in to change notification settings - Fork 32
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
Fix logging yet again #599
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This clearly moves into a good direction. I must confess though that I do not grasp this fully. For example, I don't get why reinit=True
is necessary for each initLogging
call in the various CLIs. (Shouldn't the overrideLogLevel
be restricted to only set the global variable for getLogger, and unset any existing log levels?)
Note that in my review I went through each commit individually, so some of the comments don't apply after a later commit anymore.
Codecov Report
@@ Coverage Diff @@
## master #599 +/- ##
==========================================
+ Coverage 84.88% 84.93% +0.04%
==========================================
Files 52 52
Lines 2892 2934 +42
Branches 565 570 +5
==========================================
+ Hits 2455 2492 +37
- Misses 328 332 +4
- Partials 109 110 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are nearly there (if not already) IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! (So OCR-D finally has a truly commendable and Pythonic logging system, both functionally and by implementation.)
This PR is an attempt to fix a lot of code smell related to logging.
getLogger
will raise an exception ifinitLogging
was never called beforegetLogger
beforeinitLogging
will emit CRITICAL log messages about that fact and the file/line where it originatedsetOverrideLogLevel
can now happen beforeinitLogging
(cmdline loglevel override does not work anymore #597)disableLogging
which requires a newinitLogging
call and resets override loglevellogging.NOTSET
setOverrideLoglevel
should take precedent over either.Since logging happens in many places, PR is probably better digestable commit-by-commit.