docs: 日志时间格式去掉毫秒,统一到秒

日志示例中的时间从 yyyy-MM-dd HH:mm:ss.SSS 修正为 yyyy-MM-dd HH:mm:ss

Made-with: Cursor
This commit is contained in:
bujinyuan
2026-02-28 10:03:19 +08:00
parent 1e53df7539
commit ee6a07ca64
2 changed files with 3 additions and 3 deletions

View File

@@ -327,7 +327,7 @@ func TraceMiddleware() gin.HandlerFunc {
```json ```json
{ {
"level": "info", "level": "info",
"ts": "2026-02-27 10:30:00.123", "ts": "2026-02-27 10:30:00",
"trace_id": "abc-123-def-456", "trace_id": "abc-123-def-456",
"module": "auth", "module": "auth",
"func": "service.auth_service.Login", "func": "service.auth_service.Login",

View File

@@ -203,12 +203,12 @@ type LogConfig struct {
**日志输出格式示例(开发环境):** **日志输出格式示例(开发环境):**
``` ```
2026-02-27 10:30:00.123 INFO [abc-123] auth | service.Login | 用户登录成功 | account=zhangsan | latency=25ms 2026-02-27 10:30:00 INFO [abc-123] auth | service.Login | 用户登录成功 | account=zhangsan | latency=25ms
``` ```
**日志输出格式示例(生产环境 JSON** **日志输出格式示例(生产环境 JSON**
```json ```json
{"level":"info","ts":"2026-02-27 10:30:00.123","trace_id":"abc-123","module":"auth","func":"service.Login","msg":"用户登录成功","account":"zhangsan","latency_ms":25} {"level":"info","ts":"2026-02-27 10:30:00","trace_id":"abc-123","module":"auth","func":"service.Login","msg":"用户登录成功","account":"zhangsan","latency_ms":25}
``` ```
**Step 4: 创建数据库连接** **Step 4: 创建数据库连接**