Log management plugins

class openpaperwork_core.log_collector.LogHandler[source]
emit(record)[source]

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.

on_uncatched_exception_cb(exc_type, exc_value, exc_tb)[source]
class openpaperwork_core.log_collector.Plugin[source]
CONFIG_FILE_SEPARATOR = ','
CONFIG_LOG_FILES = 'files'
CONFIG_LOG_FORMAT = 'format'
CONFIG_LOG_LEVEL = 'level'
CONFIG_SECTION = 'logging'
DEFAULT_LOG_FILES = 'stderr,temp'
DEFAULT_LOG_FORMAT = '[%(levelname)-6s] [%(name)-30s] %(message)s\n'
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]

Return the dependencies required by this plugin.

Example:

[
  {
    "interface": "some_interface_name",  # required
    "defaults": ['plugin_a', 'plugin_b'],  # required
    "expected_already_satisfied": False,  # optional, default: True
  },
]
get_interfaces()[source]

Indicates the list of interfaces implemented by this plugin. Interface names are arbitrarily defined. Methods provided by each interface are arbitrarily defined (and no checks are done).

Returns a list of string.

init(core)[source]

Minimalist log handling. Print everything to stdout by default

class openpaperwork_core.log_print.ColorFormatter(fmt=None, datefmt=None, style='%')[source]
format(record)[source]

Format the specified record as text.

The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.

class openpaperwork_core.log_print.LogHandler[source]
emit(record)[source]

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.

on_uncatched_exception_cb(exc_type, exc_value, exc_tb)[source]
out_fd
class openpaperwork_core.log_print.Plugin[source]
get_interfaces()[source]

Indicates the list of interfaces implemented by this plugin. Interface names are arbitrarily defined. Methods provided by each interface are arbitrarily defined (and no checks are done).

Returns a list of string.

set_log_level(level)[source]
set_log_output(fd)[source]