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.disableLogging()[source]
ocrd_utils.logging.getLevelName(lvl)[source]

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

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

Wrapper around logging.getLogger that respects overrideLogLevel.

ocrd_utils.logging.initLogging()[source]

Reset root logger, read logging configuration if exists, otherwise use basicConfig

ocrd_utils.logging.setOverrideLogLevel(lvl, silent=False)[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.

  • silent (boolean) – Whether to log the override call