新版本

This commit is contained in:
2025-11-15 18:46:03 +08:00
parent 9f97ac3f21
commit 73d17836d7
68 changed files with 49834 additions and 69055 deletions
+4 -2
View File
@@ -7,6 +7,7 @@
import os
import sys
import logging
from logging.handlers import RotatingFileHandler
from datetime import datetime
from pathlib import Path
from typing import Optional, Dict
@@ -58,7 +59,8 @@ def setup_logger(name: str,
# 创建文件处理器
try:
file_handler = logging.FileHandler(log_file, encoding='utf-8')
# 使用滚动日志,限制单个日志大小与备份数量
file_handler = RotatingFileHandler(log_file, maxBytes=5 * 1024 * 1024, backupCount=3, encoding='utf-8')
file_handler.setFormatter(formatter)
file_handler.setLevel(level)
logger.addHandler(file_handler)
@@ -175,4 +177,4 @@ def cleanup_active_marker(name: str) -> None:
if os.path.exists(active_marker):
os.remove(active_marker)
except Exception as e:
print(f"无法清理日志活跃标记: {e}")
print(f"无法清理日志活跃标记: {e}")