Skip to content

Commit 61e7f39

Browse files
committed
refactored logger to remove extending it with fields permanently
1 parent f1bac26 commit 61e7f39

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

coderd/httpmw/logger.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func (c *RequestLoggerContext) WriteLog(ctx context.Context, status int) {
9090
c.written = true
9191
end := time.Now()
9292

93-
c.WithFields(
93+
logger := c.log.With(
9494
slog.F("took", end.Sub(c.start)),
9595
slog.F("status_code", status),
9696
slog.F("latency_ms", float64(end.Sub(c.start)/time.Millisecond)),
@@ -99,9 +99,9 @@ func (c *RequestLoggerContext) WriteLog(ctx context.Context, status int) {
9999
// includes proxy errors etc. It also causes slogtest to fail
100100
// instantly without an error message by default.
101101
if status >= http.StatusInternalServerError {
102-
c.log.Warn(ctx, c.message)
102+
logger.Warn(ctx, c.message)
103103
} else {
104-
c.log.Debug(ctx, c.message)
104+
logger.Debug(ctx, c.message)
105105
}
106106
}
107107

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy