refactor: add shared logging crate

This commit is contained in:
2026-04-21 12:08:42 +08:00
parent 07fcbe4a2f
commit 854a7a2568
18 changed files with 280 additions and 68 deletions

View File

@@ -26,8 +26,8 @@
4. `src/app.rs`
5. `src/state.rs`
6. `src/config.rs`
7. `src/logging.rs`
8. 基础 `TraceLayer` 挂载与 `tracing subscriber` 初始化
7. 基础 `TraceLayer` 挂载
8. 接入 `shared-logging` 完成 `tracing subscriber` 初始化
后续与本 crate 直接相关的任务包括:
@@ -39,7 +39,7 @@
当前 tracing 约定:
1. 进程启动时统一初始化 `tracing subscriber`
1. 进程启动时通过 `shared-logging` 统一初始化 `tracing subscriber`
2. 默认日志过滤器来自 `GENARRATIVE_API_LOG`,未提供时回落到 `info,tower_http=info`
3. HTTP 访问日志统一通过 Axum 路由层的 `TraceLayer` 输出,后续 `request_id`、响应头与错误中间件继续在同一层扩展。