fix(manage_logs): 修复 douyin_logging 拆分后的 import 回归
douyin/logging/douyin_logging.py 在 e35e8a8 commit 拆分为子包后,
原文件改成 re-export shim,不再"恰好"暴露 module-level 的 path_config
和全局变量 _log_monitor。
bin/manage_logs.py 之前依赖这两个间接 import:
from douyin.logging.douyin_logging import path_config # 副作用
from douyin.logging.douyin_logging import _log_monitor # 全局变量
修复:
- path_config 改为直接从源头导入:from douyin.core import path_config
- _log_monitor 改为从子包内部状态读取:
from douyin.logging.douyin_logging_pkg import _common as _logging_state
_log_monitor = _logging_state._log_monitor
回归:
- bin/manage_logs.py --help / monitor / stats 三个子命令全部正常
- pytest 353 passed / 1 skipped 不变
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
1 parent
2523668b4c
commit
7715b93eca
1 file changed
+3
-2
+3
-2
@@ -30,11 +30,11 @@ from typing import Dict, Any
|
||||
# 添加项目根到 sys.path(从 bin/ 目录运行时需要)
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from douyin.core import path_config
|
||||
from douyin.logging.douyin_logging import (
|
||||
cleanup_old_logs,
|
||||
compress_log_file,
|
||||
get_log_stats,
|
||||
path_config
|
||||
)
|
||||
|
||||
|
||||
@@ -178,7 +178,8 @@ def show_monitor_status() -> None:
|
||||
"""显示监控器状态"""
|
||||
print("\n=== 日志监控状态 ===")
|
||||
|
||||
from douyin.logging.douyin_logging import _log_monitor
|
||||
from douyin.logging.douyin_logging_pkg import _common as _logging_state
|
||||
_log_monitor = _logging_state._log_monitor
|
||||
|
||||
if _log_monitor and _log_monitor._running:
|
||||
print("状态: 运行中")
|
||||
|
||||
Reference in new issue
Block a user