ocrd_utils.logging module

Logging setup

By default: Log with lastResort logger, usually STDERR.

Logging can be overridden either programmatically in code using the library or by creating one or more of

  • /etc/ocrd_logging.py
  • $HOME/ocrd_logging.py
  • $PWD/ocrd_logging.py

These files will be executed in the context of ocrd/ocrd_logging.py, with logging global set.

ocrd_utils.logging.getLogger(*args, **kwargs)[source]

Wrapper around logging.getLogger that respects overrideLogLevel.

ocrd_utils.logging.getLevelName(lvl)[source]

Get (numerical) python logging level for (string) spec-defined log level name.

ocrd_utils.logging.initLogging()[source]

Sets logging defaults

ocrd_utils.logging.setOverrideLogLevel(lvl)[source]

Override all logger filter levels to include lvl and above.

  • Set root logger level
  • iterates all existing loggers and sets their log level to NOTSET.
Parameters:lvl (string) – Log level name.