add reqId to all logging messages I could find

This commit is contained in:
crapStone 2024-12-29 19:28:27 +01:00
parent 2438de0eb2
commit f87c692f7a
No known key found for this signature in database
GPG key ID: 22D4BF0CF7CC29C8
17 changed files with 89 additions and 54 deletions

View file

@ -26,9 +26,9 @@ func Handler(
canonicalDomainCache, redirectsCache cache.ICache,
) http.HandlerFunc {
return func(w http.ResponseWriter, req *http.Request) {
log.Debug().Msg("\n----------------------------------------------------------")
log := log.With().Strs("Handler", []string{req.Host, req.RequestURI}).Logger()
ctx := context.New(w, req)
log := log.With().Str("ReqId", ctx.ReqId).Strs("Handler", []string{req.Host, req.RequestURI}).Logger()
log.Debug().Msg("\n----------------------------------------------------------")
ctx.RespWriter.Header().Set("Server", "pages-server")