update 日志模块初见

This commit is contained in:
FrankCV2048
2024-09-08 22:27:26 +08:00
parent ab2545895b
commit 55227fc898
6 changed files with 162 additions and 53 deletions

13
Util/util_log.py Normal file
View 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)