The openstack_dashboard.openstack.common.log ModuleΒΆ

Openstack logging handler.

This module adds to logging functionality by adding the option to specify a context object when calling the various log methods. If the context object is not specified, default formatting is used. Additionally, an instance uuid may be passed as part of the log message, which is intended to make it easier for admins to find messages related to a specific instance.

It also allows setting of formatting information through conf.

class openstack_dashboard.openstack.common.log.BaseLoggerAdapter(logger, extra)[source]

Bases: logging.LoggerAdapter

BaseLoggerAdapter.audit(msg, *args, **kwargs)[source]
class openstack_dashboard.openstack.common.log.ColorHandler(stream=None)[source]

Bases: logging.StreamHandler

ColorHandler.LEVEL_COLORS = {40: '\x1b[01;31m', 10: '\x1b[00;32m', 50: '\x1b[01;31m', 20: '\x1b[00;36m', 21: '\x1b[01;36m', 30: '\x1b[01;33m'}
ColorHandler.format(record)[source]
class openstack_dashboard.openstack.common.log.ContextAdapter(logger, project_name, version_string)[source]

Bases: openstack_dashboard.openstack.common.log.BaseLoggerAdapter

ContextAdapter.deprecated(msg, *args, **kwargs)[source]
ContextAdapter.handlers[source]
ContextAdapter.process(msg, kwargs)[source]
ContextAdapter.warn(msg, *args, **kwargs)

Delegate a warning call to the underlying logger, after adding contextual information from this adapter instance.

class openstack_dashboard.openstack.common.log.ContextFormatter(fmt=None, datefmt=None)[source]

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.

For information about what variables are available for the formatter see: http://docs.python.org/library/logging.html#formatter

ContextFormatter.format(record)[source]

Uses contextstring if request_id is set, otherwise default.

ContextFormatter.formatException(exc_info, record=None)[source]

Format exception output with CONF.logging_exception_prefix.

exception openstack_dashboard.openstack.common.log.DeprecatedConfig(msg)[source]

Bases: exceptions.Exception

DeprecatedConfig.message = u'Fatal call to deprecated config: %(msg)s'
class openstack_dashboard.openstack.common.log.JSONFormatter(fmt=None, datefmt=None)[source]

Bases: logging.Formatter

JSONFormatter.format(record)[source]
JSONFormatter.formatException(ei, strip_newlines=True)[source]
class openstack_dashboard.openstack.common.log.LazyAdapter(name='unknown', version='unknown')[source]

Bases: openstack_dashboard.openstack.common.log.BaseLoggerAdapter

LazyAdapter.logger[source]
exception openstack_dashboard.openstack.common.log.LogConfigError(log_config, err_msg)[source]

Bases: exceptions.Exception

LogConfigError.message = u'Error loading logging config %(log_config)s: %(err_msg)s'
class openstack_dashboard.openstack.common.log.WritableLogger(logger, level=20)[source]

Bases: object

A thin wrapper that responds to write and logs.

WritableLogger.write(msg)[source]
openstack_dashboard.openstack.common.log.getLazyLogger(name='unknown', version='unknown')[source]

create a pass-through logger that does not create the real logger until it is really needed and delegates all calls to the real logger once it is created

openstack_dashboard.openstack.common.log.getLogger(name='unknown', version='unknown')[source]
openstack_dashboard.openstack.common.log.set_defaults(logging_context_format_string)[source]
openstack_dashboard.openstack.common.log.setup(product_name)[source]

Setup logging.

Previous topic

The openstack_dashboard.openstack.common.service Module

Next topic

The openstack_dashboard.openstack.common.uuidutils Module

This Page