合并35kg
This commit is contained in:
@ -51,9 +51,18 @@ class Logger(QObject):
|
||||
|
||||
handler = TimedRotatingFileHandler(file_path, when='D', interval=1, backupCount=30,encoding='utf-8')
|
||||
handler.suffix = "%Y-%m-%d"
|
||||
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
|
||||
formatter = logging.Formatter('%(asctime)s - %(levelname)s- %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
|
||||
handler.setFormatter(formatter)
|
||||
self.logger_file_info.addHandler(handler)
|
||||
# 添加错误专用日志文件
|
||||
error_handler = TimedRotatingFileHandler(
|
||||
file_path.replace('.log', '_error.log'),
|
||||
when='D', interval=1, backupCount=30, encoding='utf-8')
|
||||
error_handler.suffix = "%Y-%m-%d"
|
||||
error_handler.setLevel(logging.ERROR) # 只处理错误级别
|
||||
error_handler.setFormatter(formatter)
|
||||
self.logger_file_info.addHandler(error_handler)
|
||||
|
||||
|
||||
def _process_logs(self):
|
||||
while True:
|
||||
|
||||
Reference in New Issue
Block a user