重构跨多个模块的日志配置

- 将“get_module_logger”替换为新模块“logger_manager”中的“get_logger”,以实现一致的日志设置。
- 移除了单独的日志配置设置,转而采用集中式日志管理。
- 更新了多个文件中的日志初始化方法,包括“config.py”、“change_mood.py”、“change_relationship.py”等,以简化日志记录实践。
- 引入“logger_manager.py”,用于根据模块特定的样式处理日志配置。
This commit is contained in:
墨梓柒
2025-04-28 00:22:05 +08:00
parent 6bac8bee13
commit 12b03ecb8d
43 changed files with 411 additions and 230 deletions

View File

@@ -4,7 +4,7 @@ from src.config.config import global_config
import time
from typing import Optional, List, Dict, Tuple, Callable, Coroutine
import traceback
from src.common.logger import get_module_logger, LogConfig, SUB_HEARTFLOW_STYLE_CONFIG # noqa: E402
from src.common.logger_manager import get_logger
import random
from src.plugins.chat.message import MessageRecv
from src.plugins.chat.chat_stream import chat_manager
@@ -24,12 +24,7 @@ from src.heart_flow.sub_mind import SubMind
# 定义常量 (从 interest.py 移动过来)
MAX_INTEREST = 15.0
subheartflow_config = LogConfig(
# 使用海马体专用样式
console_format=SUB_HEARTFLOW_STYLE_CONFIG["console_format"],
file_format=SUB_HEARTFLOW_STYLE_CONFIG["file_format"],
)
logger = get_module_logger("subheartflow", config=subheartflow_config)
logger = get_logger("subheartflow")
base_reply_probability = 0.05
probability_increase_rate_per_second = 0.08