fix(logging): Fix deplicated prefix+attrMsg in log message when redirectLogger is used (#16274)

This commit is contained in:
Mingyang Zheng 2024-12-09 07:32:34 -08:00 committed by GitHub
parent e5ae35f908
commit 14eb97aa7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -122,7 +122,7 @@ func (l *redirectLogger) Print(level telegraf.LogLevel, ts time.Time, prefix str
attrMsg = "(" + strings.Join(parts, ",") + ")" attrMsg = "(" + strings.Join(parts, ",") + ")"
} }
msg := []interface{}{ts.In(time.UTC).Format(time.RFC3339), level.Indicator(), prefix + attrMsg} msg := []interface{}{ts.In(time.UTC).Format(time.RFC3339), level.Indicator()}
if prefix+attrMsg != "" { if prefix+attrMsg != "" {
msg = append(msg, prefix+attrMsg) msg = append(msg, prefix+attrMsg)
} }