oslo_log.formatters

class oslo_log.formatters.ContextFormatter(*args, **kwargs)

Bases: logging.Formatter

A context.RequestContext aware formatter configured through flags.

The flags used to set format strings are: logging_context_format_string and logging_default_format_string. You can also specify logging_debug_format_suffix to append extra formatting if the log level is debug.

The standard variables available to the formatter are listed at: http://docs.python.org/library/logging.html#formatter

In addition to the standard variables, one custom variable is available to both formatting string: isotime produces a timestamp in ISO8601 format, suitable for producing RFC5424-compliant log messages.

Furthermore, logging_context_format_string has access to all of the data in a dict representation of the context.

If available, uses the context value stored in TLS - local.store.context

format(record)

Uses contextstring if request_id is set, otherwise default.

formatException(exc_info, record=None)

Format exception output with CONF.logging_exception_prefix.

class oslo_log.formatters.JSONFormatter(fmt=None, datefmt=None)

Bases: logging.Formatter

format(record)
formatException(ei, strip_newlines=True)

Previous topic

oslo_log.fixture

Next topic

oslo_log.handlers

Project Source

This Page