refactor(logger): 统一日志配置并添加模块特定样式

为远程、表情、主程序、后台任务等模块添加了特定的日志样式配置,并统一了日志初始化方式,以提高日志的可读性和一致性。
This commit is contained in:
墨梓柒
2025-04-23 23:16:20 +08:00
parent e9a5c773c4
commit 79260d3b86
5 changed files with 81 additions and 8 deletions

View File

@@ -14,9 +14,14 @@ from ...config.config import global_config
from ..chat.utils import get_embedding
from ..chat.utils_image import ImageManager, image_path_to_base64
from ..models.utils_model import LLMRequest
from src.common.logger import get_module_logger
from src.common.logger import get_module_logger, LogConfig, EMOJI_STYLE_CONFIG
logger = get_module_logger("emoji")
emoji_log_config = LogConfig(
console_format=EMOJI_STYLE_CONFIG["console_format"],
file_format=EMOJI_STYLE_CONFIG["file_format"],
)
logger = get_module_logger("emoji", config=emoji_log_config)
image_manager = ImageManager()

View File

@@ -5,10 +5,15 @@ import platform
import os
import json
import threading
from src.common.logger import get_module_logger
from src.common.logger import get_module_logger, LogConfig, REMOTE_STYLE_CONFIG
from src.config.config import global_config
logger = get_module_logger("remote")
remote_log_config = LogConfig(
console_format=REMOTE_STYLE_CONFIG["console_format"],
file_format=REMOTE_STYLE_CONFIG["file_format"],
)
logger = get_module_logger("remote", config=remote_log_config)
# UUID文件路径
UUID_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "client_uuid.json")