Add context to log statements.

This commit is contained in:
Maximilian Paß
2023-04-11 19:24:06 +01:00
parent 43221c717e
commit 0c8fa9ccfa
16 changed files with 97 additions and 88 deletions

View File

@ -77,7 +77,7 @@ func HTTPLoggingMiddleware(next http.Handler) http.Handler {
next.ServeHTTP(lrw, r)
latency := time.Now().UTC().Sub(start)
logEntry := log.WithFields(logrus.Fields{
logEntry := log.WithContext(r.Context()).WithFields(logrus.Fields{
"code": lrw.StatusCode,
"method": r.Method,
"path": path,