Conversation
bertsky
left a comment
There was a problem hiding this comment.
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.
|
bertsky
left a comment
There was a problem hiding this comment.
We are nearly there (if not already) IMO.
bertsky
left a comment
There was a problem hiding this comment.
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.
getLoggerwill raise an exception ifinitLoggingwas never called beforegetLoggerbeforeinitLoggingwill emit CRITICAL log messages about that fact and the file/line where it originatedsetOverrideLogLevelcan now happen beforeinitLogging(cmdline loglevel override does not work anymore #597)disableLoggingwhich requires a newinitLoggingcall and resets override loglevellogging.NOTSETsetOverrideLoglevelshould take precedent over either.Since logging happens in many places, PR is probably better digestable commit-by-commit.