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.
oslo_log.log.
BaseLoggerAdapter
(logger, extra)¶Bases: logging.LoggerAdapter
handlers
¶trace
(msg, *args, **kwargs)¶warn
(msg, *args, **kwargs)¶Delegate a warning call to the underlying logger.
oslo_log.log.
KeywordArgumentAdapter
(logger, extra)¶Bases: oslo_log.log.BaseLoggerAdapter
Logger adapter to add keyword arguments to log record’s extra data
Keywords passed to the log call are added to the “extra” dictionary passed to the underlying logger so they are emitted with the log message and available to the format string.
Special keywords:
name
key or type
id
keys.process
(msg, kwargs)¶Process the logging message and keyword arguments passed in to a logging call to insert contextual information. You can either manipulate the message itself, the keyword args or both. Return the message and kwargs modified (or not) to suit your needs.
Normally, you’ll only need to override this one method in a LoggerAdapter subclass for your specific needs.
oslo_log.log.
LogConfigError
(log_config, err_msg)¶Bases: Exception
message
= 'Error loading logging config %(log_config)s: %(err_msg)s'¶oslo_log.log.
getLogger
(name=None, project='unknown', version='unknown')¶Build a logger with the given name.
Parameters: |
|
---|
oslo_log.log.
get_default_log_levels
()¶Return the Oslo Logging default log levels.
Returns a copy of the list so an application can change the value and not affect the default value used in the log_opts configuration setup.
oslo_log.log.
get_loggers
()¶Return a copy of the oslo loggers dictionary.
oslo_log.log.
is_debug_enabled
(conf)¶Determine if debug logging mode is enabled.
oslo_log.log.
register_options
(conf)¶Register the command line and configuration options used by oslo.log.
oslo_log.log.
set_defaults
(logging_context_format_string=None, default_log_levels=None)¶Set default values for the configuration options used by oslo.log.
oslo_log.log.
setup
(conf, product_name, version='unknown')¶Setup logging for the current application.
oslo_log.log.
tempest_set_log_file
(filename)¶Provide an API for tempest to set the logging filename.
Warning
Only Tempest should use this function.
We don’t want applications to set a default log file, so we don’t want this in set_defaults(). Because tempest doesn’t use a configuration file we don’t have another convenient way to safely set the log file default.
See also
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.