cement.ext.ext_colorlog

Cement Colorlog extension module.

Note This extension has an external dependency on colorlog. Cement explicitly does not include external dependencies for optional extensions.

  • In Cement >=3.0.8 you must include cement[colorlog] in your applications dependencies.

  • In Cement <3.0.8 you must include colorlog in your applications dependencies.

class cement.ext.ext_colorlog.ColorLogHandler(*args, **kw)[source]

Bases: LoggingLogHandler

This class implements the Log Handler interface. It is a sub-class of cement.ext.ext_logging.LoggingLogHandler which is based on the standard logging library, and adds colorized console output using the ColorLog library.

class Meta[source]

Bases: object

Handler meta-data.

colors = {'CRITICAL': 'red,bg_white', 'DEBUG': 'cyan', 'ERROR': 'red', 'INFO': 'green', 'WARNING': 'yellow'}

Color mapping for each log level

config_defaults = {'colorize_console_log': True, 'colorize_file_log': False, 'file': None, 'level': 'INFO', 'max_bytes': 512000, 'max_files': 4, 'rotate': False, 'to_console': True}

Default configuration settings. Will be overridden by the same settings in any application configuration file under a [log.colorlog] block.

formatter_class

Formatter class to use for colorized logging

alias of ColoredFormatter

formatter_class_without_color

Formatter class to use for non-colorized logging (non-tty, file, etc)

alias of Formatter

label = 'colorlog'

The string identifier of the handler.