qurator-spk / dinglehopper

An OCR evaluation tool
Apache License 2.0
59 stars 13 forks source link

1 more update for core's getLogger context #43

Closed bertsky closed 3 years ago

bertsky commented 3 years ago

This avoids:

CRITICAL root - getLogger was called before initLogging. Source of the call:
CRITICAL root -   File "qurator/dinglehopper/extracted_text.py", line 13, in <module>
CRITICAL root -     LOG = getLogger('processor.OcrdDinglehopperEvaluate')
CRITICAL root - initLogging was called multiple times. Source of latest call:
CRITICAL root -   File "ocrd/decorators/__init__.py", line 40, in ocrd_cli_wrap_processor
CRITICAL root -     initLogging()
b2m commented 3 years ago

I expected to be able to call getLogger even on the toplevel to avoid having function calls with every execution of a function using logging.

bertsky commented 3 years ago

I expected to be able to call getLogger even on the toplevel to avoid having function calls with every execution of a function using logging.

Yes, that's a big downside of the recent changes in core. But AFAICT there' s no problem if you just use standard Python's logging.getLogger instead – ocrd_utils.logging will pick up the existing loggers (overriding their level if --log-level was used on the CLI) and destroy any default logging.basicConfig.

So whatever suits you better IMO.