(fieldKey string)
| 77 | } |
| 78 | |
| 79 | func URLHandler(fieldKey string) func(next http.Handler) http.Handler { |
| 80 | return func(next http.Handler) http.Handler { |
| 81 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 82 | log := zerolog.Ctx(r.Context()) |
| 83 | log.UpdateContext(func(c zerolog.Context) zerolog.Context { |
| 84 | if r.URL.RawPath != "" { |
| 85 | return c.Str(fieldKey, r.URL.RawPath+"?"+r.URL.RawQuery) |
| 86 | } |
| 87 | return c.Str(fieldKey, r.URL.Path+"?"+r.URL.RawQuery) |
| 88 | }) |
| 89 | next.ServeHTTP(w, r) |
| 90 | }) |
| 91 | } |
| 92 | } |
no test coverage detected
searching dependent graphs…