sugar.logger: Use formatters properly when interfacing with logging.

This fixes display of tracebacks in the logs, and adds logger names
This commit is contained in:
Simon McVittie 2007-05-08 16:24:48 +01:00
parent 05d7ed5084
commit 1f024ff6e4

View File

@ -29,6 +29,8 @@ _log_writer = None
STDOUT_LEVEL = 1000
STDERR_LEVEL = 2000
formatter = logging.Formatter('%(name)s: %(message)s')
class LogWriter:
def __init__(self, module_id):
self._module_id = module_id
@ -38,7 +40,7 @@ class LogWriter:
self._log_file = open(log_path, 'w')
def write_record(self, record):
self.write(record.levelno, record.getMessage())
self.write(record.levelno, formatter.format(record))
def write(self, level, msg):
if level == logging.ERROR: