chore: add comments (#4618)

This commit is contained in:
Kevin Wan
2025-01-31 22:42:46 +08:00
committed by GitHub
parent 84db9bcd15
commit 4e71e95e44
3 changed files with 34 additions and 21 deletions

View File

@@ -206,8 +206,9 @@ func (l *richLogger) WithFields(fields ...LogField) Logger {
func (l *richLogger) buildFields(fields ...LogField) []LogField {
fields = append(l.fields, fields...)
// caller field should always appear together with global fields
fields = append(fields, Field(callerKey, getCaller(callerDepth+l.callerSkip)))
fields = combineGlobalFields(fields)
fields = mergeGlobalFields(fields)
if l.ctx == nil {
return fields
@@ -235,7 +236,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...)...)
}
}