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.

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.FluentFormatter(fmt=None, datefmt=None)

Bases: logging.Formatter

A formatter for fluentd.

format() returns dict, not string. It expects to be used by fluent.handler.FluentHandler. (included in fluent-logger-python)

New in version 3.17.

format(record)
formatException(exc_info, strip_newlines=True)
class oslo_log.formatters.JSONFormatter(fmt=None, datefmt=None)

Bases: logging.Formatter

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