The ceilometer.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 ceilometer.openstack.common.log.BaseLoggerAdapter(logger, extra)[source]

Bases: logging.LoggerAdapter

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

Bases: logging.StreamHandler

format(record)[source]
class ceilometer.openstack.common.log.ContextAdapter(logger, project_name, version_string)[source]

Bases: ceilometer.openstack.common.log.BaseLoggerAdapter

deprecated(msg, *args, **kwargs)[source]

Call this method when a deprecated feature is used.

If the system is configured for fatal deprecations then the message is logged at the ‘critical’ level and DeprecatedConfig will be raised.

Otherwise, the message will be logged (once) at the ‘warn’ level.

Raises:DeprecatedConfig if the system is configured for fatal deprecations.
process(msg, kwargs)[source]
warn(msg, *args, **kwargs)

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

class ceilometer.openstack.common.log.ContextFormatter(*args, **kwargs)[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

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

format(record)[source]

Uses contextstring if request_id is set, otherwise default.

formatException(exc_info, record=None)[source]

Format exception output with CONF.logging_exception_prefix.

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

Bases: exceptions.Exception

class ceilometer.openstack.common.log.JSONFormatter(fmt=None, datefmt=None)[source]

Bases: logging.Formatter

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

Bases: ceilometer.openstack.common.log.BaseLoggerAdapter

exception ceilometer.openstack.common.log.LogConfigError(log_config, err_msg)[source]

Bases: exceptions.Exception

class ceilometer.openstack.common.log.RFCSysLogHandler(*args, **kwargs)[source]

Bases: logging.handlers.SysLogHandler

format(record)[source]
class ceilometer.openstack.common.log.WritableLogger(logger, level=20)[source]

Bases: object

A thin wrapper that responds to write and logs.

write(msg)[source]