This commit is contained in:
2025-09-24 10:17:11 +08:00
parent dfb07d679f
commit c055a68592
31 changed files with 1357 additions and 811 deletions

View File

@@ -4,16 +4,28 @@ from logging.handlers import TimedRotatingFileHandler
from dotenv import load_dotenv
# 导入新的配置系统,保持向后兼容
from .settings import get_config, get_ffmpeg_config, get_api_config, get_storage_config, get_server_config
from .settings import (
get_config,
get_ffmpeg_config,
get_api_config,
get_storage_config,
get_server_config,
)
load_dotenv()
logging.basicConfig(level=logging.INFO)
root_logger = logging.getLogger()
rf_handler = TimedRotatingFileHandler('all_log.log', when='midnight')
rf_handler.setFormatter(logging.Formatter("[%(asctime)s][%(name)s]%(levelname)s - %(message)s"))
rf_handler = TimedRotatingFileHandler("all_log.log", when="midnight")
rf_handler.setFormatter(
logging.Formatter("[%(asctime)s][%(name)s]%(levelname)s - %(message)s")
)
rf_handler.setLevel(logging.DEBUG)
f_handler = TimedRotatingFileHandler('error.log', when='midnight')
f_handler = TimedRotatingFileHandler("error.log", when="midnight")
f_handler.setLevel(logging.ERROR)
f_handler.setFormatter(logging.Formatter("[%(asctime)s][%(name)s][:%(lineno)d]%(levelname)s - - %(message)s"))
f_handler.setFormatter(
logging.Formatter(
"[%(asctime)s][%(name)s][:%(lineno)d]%(levelname)s - - %(message)s"
)
)
root_logger.addHandler(rf_handler)
root_logger.addHandler(f_handler)
root_logger.addHandler(f_handler)