color_bucket_logger.styles module

class color_bucket_logger.styles.PercentStyle(fmt)[source]

Bases: object

context_color_format_string(format_string, format_attrs)[source]

For extending a format string for logging.Formatter to include attributes with color info.

ie:

'%(process)d %(threadName)s - %(msg)'

becomes:

'%(_cdl_process)s%(process)d%(_cdl_reset)s %(_cdl_threadName)%(threadName)s%(_cdl_reset)s - %(msg)'
find_format_attrs(format_string)[source]
format(record)[source]
usesTime()[source]
validate()[source]

Validate the input format, ensure it matches the correct style

asctime_format = '%(asctime)s'
attrs_pattern = re.compile('(?P<full_attr>%\\((?P<attr_name>.*?)\\).*?[dsf])')
attrs_pattern_str = '(?P<full_attr>%\\((?P<attr_name>.*?)\\).*?[dsf])'
color_fmt
default_format = '%(message)s'
named_fields_pattern = '(?P<full_attr>%\\((?P<attr_name>.*?)\\)(?P<conversion_flag>[#0+ -]*)(?P<field_width>\\*|\\d+)?(?P<precision>\\.(\\*|\\d+))?(?P<conversion_type>[diouxefgcrsa%]))'
validation_pattern = re.compile('%\\(\\w+\\)[#0+ -]*(\\*|\\d+)?(\\.(\\*|\\d+))?[diouxefgcrsa%]', re.IGNORECASE)
class color_bucket_logger.styles.StrFormatStyle(fmt)[source]

Bases: color_bucket_logger.styles.PercentStyle

context_color_format_string(format_string, format_attrs)[source]

For extending a format string for logging.Formatter to include attributes with color info.

ie:

'%(process)d %(threadName)s - %(msg)'

becomes:

'%(_cdl_process)s%(process)d%(_cdl_reset)s %(_cdl_threadName)%(threadName)s%(_cdl_reset)s - %(msg)'
find_format_attrs(format_string)[source]
validate()[source]

Validate the input format, ensure it is the correct string formatting style

asctime_format = '{asctime}'
default_format = '{message}'
field_spec = re.compile('^(\\d+|\\w+)(\\.\\w+|\\[[^]]+\\])*$')
fmt_spec = re.compile('^(.?[<>=^])?[+ -]?#?0?(\\d+|{\\w+})?[,_]?(\\.(\\d+|{\\w+}))?[bcdefgnosx%]?$', re.IGNORECASE)
uber_format_pattern = '(?P<full_attr>{(?P<attr_name>\\d+|\\w+)[:]?(?P<modifiers>(?P<align>.?[<>=^]?)(?P<sign>[+ -]?)#?0?(?P<width>\\d+|{\\w+})?[,_]?(\\.(\\d+|{\\w+}))?(?P<conversion_type>[bcdefgnosx%])?)})'