oslo_log.handlers

oslo_log.handlers

class oslo_log.handlers.ColorHandler(stream=None)

Bases: logging.StreamHandler

Log handler that sets the ‘color’ key based on the level

To use, include a ‘%(color)s’ entry in the logging_context_format_string. There is also a ‘%(reset_color)s’ key that can be used to manually reset the color within a log line.

LEVEL_COLORS = {5: '\x1b[00;35m', 10: '\x1b[00;32m', 20: '\x1b[00;36m', 21: '\x1b[01;36m', 30: '\x1b[01;33m', 40: '\x1b[01;31m', 50: '\x1b[01;31m'}
format(record)

Format the specified record.

If a formatter is set, use it. Otherwise, use the default formatter for the module.

class oslo_log.handlers.OSJournalHandler

Bases: logging.Handler

custom_fields = ('project_name', 'project_id', 'user_name', 'user_id', 'request_id')
emit(record)

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.

class oslo_log.handlers.OSSysLogHandler(facility=None)

Bases: logging.Handler

Syslog based handler. Only available on UNIX-like platforms.

emit(record)

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.