fix(logging): Clean up extra empty spaces when redirectLogger is used (#16255)
This commit is contained in:
parent
0ea4c1422e
commit
0c74b68f55
|
|
@ -119,10 +119,15 @@ func (l *redirectLogger) Print(level telegraf.LogLevel, ts time.Time, prefix str
|
|||
for k, v := range attr {
|
||||
parts = append(parts, fmt.Sprintf("%s=%v", k, v))
|
||||
}
|
||||
attrMsg = " (" + strings.Join(parts, ",") + ")"
|
||||
attrMsg = "(" + strings.Join(parts, ",") + ")"
|
||||
}
|
||||
|
||||
msg := append([]interface{}{ts.In(time.UTC).Format(time.RFC3339), " ", level.Indicator(), " ", prefix + attrMsg}, args...)
|
||||
msg := []interface{}{ts.In(time.UTC).Format(time.RFC3339), level.Indicator(), prefix + attrMsg}
|
||||
if prefix+attrMsg != "" {
|
||||
msg = append(msg, prefix+attrMsg)
|
||||
}
|
||||
msg = append(msg, args...)
|
||||
|
||||
fmt.Fprintln(l.writer, msg...)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue