Skip to content

Commit

Permalink
Merge pull request moby#48887 from thaJeztah/logger_withfields
Browse files Browse the repository at this point in the history
daemon/logger: logDriverError: use WithFields for logs
  • Loading branch information
thaJeztah authored Nov 17, 2024
2 parents be84220 + 1a16f50 commit fc68ffc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions daemon/logger/logger_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ var logErrorLimiter = rate.NewLimiter(333, 333)
func logDriverError(loggerName, msgLine string, logErr error) {
logWritesFailedCount.Inc(1)
if logErrorLimiter.Allow() {
log.G(context.TODO()).WithError(logErr).
WithField("driver", loggerName).
WithField("message", msgLine).
Errorf("Error writing log message")
log.G(context.TODO()).WithFields(log.Fields{
"error": logErr,
"driver": loggerName,
"message": msgLine,
}).Error("Error writing log message")
}
}

0 comments on commit fc68ffc

Please sign in to comment.