Source code for gwss.logger
import logging
import sys
import click
import colorlog
[docs]
sout = click.get_text_stream('stdout')
[docs]
log = logging.getLogger('GWSS')
log.setLevel(logging.DEBUG)
[docs]
sout_handler = logging.StreamHandler(sout)
[docs]
color_sout_handler = colorlog.StreamHandler(stream=sout)
sout_handler.setLevel(logging.DEBUG)
sout_handler.setFormatter(sout_formatter)
color_sout_handler.setFormatter(colorlog.ColoredFormatter(
'%(cyan)s%(asctime)s%(reset)s:%(log_color)s%(levelname)s%(reset)s%(green)s:%(name)s%(reset)s:%(message)s',
datefmt="%Y-%m-%d %H:%M:%S",
log_colors={
'DEBUG': 'light_red',
'INFO': 'green',
'WARNING': 'yellow',
'ERROR': 'red',
'CRITICAL': 'red,bg_white',
}
))
log.addHandler(color_sout_handler)