forked from M-Labs/artiq
master/log: move formatter into LogBufferHandler
This commit is contained in:
parent
cee8f288de
commit
9bb94f0f59
@ -20,6 +20,7 @@ class LogBufferHandler(logging.Handler):
|
|||||||
def __init__(self, log_buffer, *args, **kwargs):
|
def __init__(self, log_buffer, *args, **kwargs):
|
||||||
logging.Handler.__init__(self, *args, **kwargs)
|
logging.Handler.__init__(self, *args, **kwargs)
|
||||||
self.log_buffer = log_buffer
|
self.log_buffer = log_buffer
|
||||||
|
self.setFormatter(logging.Formatter("%(name)s:%(message)s"))
|
||||||
|
|
||||||
def emit(self, record):
|
def emit(self, record):
|
||||||
message = self.format(record)
|
message = self.format(record)
|
||||||
@ -87,7 +88,6 @@ def init_log(args):
|
|||||||
|
|
||||||
log_buffer = LogBuffer(1000)
|
log_buffer = LogBuffer(1000)
|
||||||
buffer_handler = LogBufferHandler(log_buffer)
|
buffer_handler = LogBufferHandler(log_buffer)
|
||||||
buffer_handler.setFormatter(logging.Formatter("%(name)s:%(message)s"))
|
|
||||||
handlers.append(buffer_handler)
|
handlers.append(buffer_handler)
|
||||||
|
|
||||||
for handler in handlers:
|
for handler in handlers:
|
||||||
|
Loading…
Reference in New Issue
Block a user