Skip to content

Commit aa3167d

Browse files
committed
refactored logger to remove extending it with fields permanently
1 parent 0e6cd07 commit aa3167d

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)