Log management plugins

Log management plugins catch Python logs (see logging), format them and send them somewhere.

log_print

Send the logs to a file descriptor. The default file descriptor is sys.stderr. Logging is configured through plugin callbacks.


Minimalist log handling. Print everything to stdout by default

class openpaperwork_core.log_print.Plugin[source]
get_interfaces()[source]
set_log_level(level)[source]

Valid log levels are: ‘none’, ‘critical’, ‘error’, ‘warn’, ‘warning’, ‘info’, ‘debug’.

set_log_output(fd)[source]

Provide the file descriptor to which the output must be written.

log_collector

Send the logs to stderr, stdout or a file. It can send to many outputs at the same time.

Configuration entries are as follow:

[logging]
level = str:info  # none, critical, error, warn, warning, info, debug
files = str:stderr,temp,/tmp/test.txt  # 'stderr', 'temp', or a file path
format = str:[%(levelname)-6s] [%(name)-30s] %(message)s

It monitors the configuration. So to change its settings, you can just update the configuration using the plugin openpaperwork_core.config.


class openpaperwork_core.log_collector.Plugin[source]
CONFIG_FILE_SEPARATOR = ','
DEFAULT_LOG_FILES = 'stderr,temp'
DEFAULT_LOG_FORMAT = '[%(levelname)-6s] [%(name)-30s] %(message)s'
DEFAULT_LOG_LEVEL = 'info'
LOG_LEVELS = {'critical': 50, 'debug': 10, 'error': 40, 'info': 20, 'none': 50, 'warn': 30, 'warning': 30}
SPECIAL_FILES = {'stderr': <function Plugin.<lambda>>, 'temp': <function _get_tmp_file>}
get_deps()[source]
get_interfaces()[source]
init(core)[source]