fix(logger): 修复 caller 字段与 OpsSystemLogSink 停止刷盘

修复点:

- zap logger 不再强制 AddCallerSkip(1),确保 caller 指向真实调用点

- slog handler 避免重复写 time 字段

- OpsSystemLogSink 优先从字段 component 识别业务组件;停止时 drain 队列并用可用 ctx 刷盘

补充:新增/完善对应单测
This commit is contained in:
yangjianbo
2026-02-12 17:42:29 +08:00
parent b7243660c4
commit 84cc651b46
6 changed files with 253 additions and 10 deletions

View File

@@ -247,7 +247,6 @@ func buildLogger(options InitOptions) (*zap.Logger, zap.AtomicLevel, error) {
if stacktraceLevel <= zapcore.FatalLevel {
zapOpts = append(zapOpts, zap.AddStacktrace(stacktraceLevel))
}
zapOpts = append(zapOpts, zap.AddCallerSkip(1))
logger := zap.New(core, zapOpts...).With(
zap.String("service", options.ServiceName),