Reformat log output

This commit is contained in:
jdegenstein
2022-09-17 21:47:59 -05:00
committed by GitHub
parent 85a7560e84
commit 9daa332fcf

View File

@@ -8,12 +8,14 @@ from ..mixins import ComponentMixin
class QtLogHandler(logging.Handler,logging.StringFormatterHandlerMixin): class QtLogHandler(logging.Handler,logging.StringFormatterHandlerMixin):
def __init__(self, log_widget,*args,**kwargs): def __init__(self, log_widget,*args,**kwargs):
super(QtLogHandler,self).__init__(*args,**kwargs)
logging.StringFormatterHandlerMixin.__init__(self,None)
self.log_widget = log_widget
super(QtLogHandler,self).__init__(*args,**kwargs)
log_format_string = '[{record.time:%H:%M:%S.%f%z}] {record.level_name}: {record.message}'
logging.StringFormatterHandlerMixin.__init__(self,log_format_string)
self.log_widget = log_widget
def emit(self, record): def emit(self, record):
msg = self.format(record) msg = self.format(record)
@@ -40,4 +42,4 @@ class LogViewer(QPlainTextEdit, ComponentMixin):
def append(self,msg): def append(self,msg):
self.appendPlainText(msg) self.appendPlainText(msg)