feat(main): loguru 文件 sink 持久化运行日志
logs/run_YYYYMMDD_HHmmss.log,500MB 轮转,保留 30 天, enqueue=True 异步写入不阻塞推理。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -234,6 +234,17 @@ def _log_result(result: object) -> None:
|
|||||||
def main() -> None:
|
def main() -> None:
|
||||||
"""入口函数。"""
|
"""入口函数。"""
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
|
log_dir = Path("logs")
|
||||||
|
log_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
logger.add(
|
||||||
|
log_dir / "run_{time:YYYYMMDD_HHmmss}.log",
|
||||||
|
rotation="500 MB",
|
||||||
|
retention="30 days",
|
||||||
|
encoding="utf-8",
|
||||||
|
enqueue=True,
|
||||||
|
)
|
||||||
|
|
||||||
parser = _build_parser()
|
parser = _build_parser()
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user