fix: 修复日志文件 level 字段包含 ANSI 颜色转义码导致乱码
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m5s

This commit is contained in:
2026-03-31 20:05:12 +08:00
parent 1c6f8ed07b
commit 724967b8b8

View File

@@ -34,8 +34,8 @@ func InitLoggers(
MessageKey: "msg",
StacktraceKey: "stacktrace",
LineEnding: zapcore.DefaultLineEnding,
EncodeLevel: zapcore.CapitalColorLevelEncoder, // 使用色级别编码器
EncodeTime: zapcore.ISO8601TimeEncoder, // 2025-11-11T17:50:52.830+0800 格式
EncodeLevel: zapcore.CapitalLevelEncoder, // 使用无颜色级别编码器,避免文件日志出现 ANSI 转义码乱码
EncodeTime: zapcore.ISO8601TimeEncoder, // 2025-11-11T17:50:52.830+0800 格式
EncodeDuration: zapcore.SecondsDurationEncoder,
EncodeCaller: zapcore.ShortCallerEncoder, // 输出 middleware/trace.go:58 格式
}