feat: 实现统一的错误处理机制和增强日志系统

添加错误码定义和统一响应格式
增强日志记录功能,支持模块专用日志记录器
实现全局异常捕获和友好错误提示
更新文档说明错误处理机制
This commit is contained in:
2026-01-19 14:05:14 +08:00
parent 698240b1a2
commit 8beeaef424
14 changed files with 1074 additions and 364 deletions

View File

@@ -4,7 +4,7 @@
"""
# 导出核心工具
from .logger import logger
from .logger import logger, ModuleLogger, log_exception
from .exceptions import *
from .json_utils import *
from .singleton import singleton
@@ -20,9 +20,12 @@ from .performance import (
performance_stats,
global_stats
)
from .error_codes import ErrorCode, get_error_message, create_error_response, exception_to_error_response
__all__ = [
'logger',
'ModuleLogger',
'log_exception',
'timeit',
'profile',
'aprofile',
@@ -34,5 +37,9 @@ __all__ = [
'global_stats',
'run_in_thread_pool',
'initialize_executor',
'singleton'
'singleton',
'ErrorCode',
'get_error_message',
'create_error_response',
'exception_to_error_response'
]