more informative formatting for printed logs

workspace
Brendan Howell 7 years ago
parent 2e74af06dd
commit b31bd3fa84

@ -101,7 +101,6 @@ class Bureau(object):
self.load_config() self.load_config()
# setup log file # setup log file
# TODO: custom handler to print errors to small printer
if hasattr(self.config, "debug"): if hasattr(self.config, "debug"):
if self.config.debug: if self.config.debug:
log_level = logging.DEBUG log_level = logging.DEBUG
@ -113,6 +112,8 @@ class Bureau(object):
logging.basicConfig(filename=logfile, level=log_level) logging.basicConfig(filename=logfile, level=log_level)
self.log = logging.getLogger(self.prefix) self.log = logging.getLogger(self.prefix)
log_printer = LogPrinter() log_printer = LogPrinter()
log_format = logging.Formatter('LOG ${levelname} $name: $message', style='$')
log_printer.setFormatter(log_format)
self.log.addHandler(log_printer) self.log.addHandler(log_printer)
# setup a dir to store files and data # setup a dir to store files and data

Loading…
Cancel
Save