feat(logging): 添加日志配置中的默认值以确保所有分支可用
This commit is contained in:
1 parent
768f04c5d5
commit
f2cd77ab0b
1 file changed
+5
-4
@@ -491,6 +491,11 @@ def configure_logging(
|
||||
"""
|
||||
global _logging_configured
|
||||
|
||||
# rotation 相关默认值(函数级),确保在所有分支可用,避免可能的未赋值使用
|
||||
rotation_enabled = False
|
||||
rotation_when = None
|
||||
rotation_interval = 1
|
||||
|
||||
# 从 config.json 读取配置
|
||||
if (
|
||||
log_level is None
|
||||
@@ -498,10 +503,6 @@ def configure_logging(
|
||||
or keep_days is None
|
||||
or use_dated_logs is None
|
||||
):
|
||||
# 预初始化 rotation 相关变量,避免静态分析报未定义
|
||||
rotation_enabled = False
|
||||
rotation_when = None
|
||||
rotation_interval = 1
|
||||
|
||||
try:
|
||||
import json
|
||||
|
||||
Reference in new issue
Block a user