Skip to content

Commit

Permalink
logging: Prep for common_log removal
Browse files Browse the repository at this point in the history
  • Loading branch information
francislavoie committed May 6, 2021
1 parent d4b2f1b commit 636dc4c
Show file tree
Hide file tree
Showing 2 changed files with 357 additions and 352 deletions.
3 changes: 3 additions & 0 deletions modules/caddyhttp/server.go
Expand Up @@ -184,8 +184,11 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
log = logger.Error
}

userID, _ := repl.GetString("http.auth.user.id")

log("handled request",
zap.String("common_log", repl.ReplaceAll(commonLogFormat, commonLogEmptyValue)),
zap.String("user_id", userID),
zap.Duration("duration", duration),
zap.Int("size", wrec.Size()),
zap.Int("status", wrec.Status()),
Expand Down

0 comments on commit 636dc4c

Please sign in to comment.