Skip to content

Commit

Permalink
fix(server): properly fix the logging (#132)
Browse files Browse the repository at this point in the history
In #130 I attempted to fix the logger, but I used the wrong logger instance when adding the bytes effectively erasing all the other fields.
  • Loading branch information
kalbasit authored Dec 17, 2024
1 parent 16c6494 commit 27f3f5e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ func requestLogger(logger zerolog.Logger) func(handler http.Handler) http.Handle

switch r.Method {
case http.MethodHead, http.MethodGet:
log = logger.With().Int("bytes", ww.BytesWritten()).Logger()
log = log.With().Int("bytes", ww.BytesWritten()).Logger()
case http.MethodPost, http.MethodPut, http.MethodPatch:
log = logger.With().Int64("bytes", r.ContentLength).Logger()
log = log.With().Int64("bytes", r.ContentLength).Logger()
}

log.Info().Msg("handled request")
Expand Down

0 comments on commit 27f3f5e

Please sign in to comment.