From 5d1e3b9c74642915d0ac50a8fd342be5aeb4c4eb Mon Sep 17 00:00:00 2001 From: jichen Date: Sun, 29 Sep 2024 11:41:43 +1000 Subject: [PATCH] fix global field append in logc --- core/logx/richlogger.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/logx/richlogger.go b/core/logx/richlogger.go index 482852e43493..c324a15e34c8 100644 --- a/core/logx/richlogger.go +++ b/core/logx/richlogger.go @@ -183,6 +183,7 @@ func (l *richLogger) WithFields(fields ...LogField) Logger { func (l *richLogger) buildFields(fields ...LogField) []LogField { fields = append(l.fields, fields...) fields = append(fields, Field(callerKey, getCaller(callerDepth+l.callerSkip))) + fields = combineGlobalFields(fields) if l.ctx == nil { return fields @@ -210,7 +211,7 @@ func (l *richLogger) buildFields(fields ...LogField) []LogField { func (l *richLogger) debug(v any, fields ...LogField) { if shallLog(DebugLevel) { - getWriter().Debug(v, l.buildFields(fields...)...) + getWriter().Debug(v, (l.buildFields(fields...))...) } }