update 日志模块初见
This commit is contained in:
13
Util/util_log.py
Normal file
13
Util/util_log.py
Normal file
@ -0,0 +1,13 @@
|
||||
import logging
|
||||
|
||||
|
||||
class QTextEditLogger(logging.Handler):
|
||||
def __init__(self, text_widget):
|
||||
super().__init__()
|
||||
self.widget = text_widget
|
||||
|
||||
def emit(self, record):
|
||||
# 格式化日志信息
|
||||
log_message = self.format(record)
|
||||
# 在主线程中更新 QTextEdit
|
||||
self.widget.append(log_message)
|
||||
Reference in New Issue
Block a user