Skip to content

Commit d380731

Browse files
committed
uses zap's .WithLazy with a cloned request
1 parent ff67b97 commit d380731

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

modules/caddyhttp/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,10 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
318318
// modified during handling
319319
shouldLogCredentials := s.Logs != nil && s.Logs.ShouldLogCredentials
320320
loggableReq := zap.Object("request", LoggableHTTPRequest{
321-
Request: r,
321+
Request: r.Copy(r.Context()),
322322
ShouldLogCredentials: shouldLogCredentials,
323323
})
324-
errLog := s.errorLogger.With(loggableReq)
324+
errLog := s.errorLogger.WithLazy(loggableReq)
325325

326326
var duration time.Duration
327327

0 commit comments

Comments
 (0)