Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
admin: lower log level to Debug for /metrics requests (#3749)
* admin: lower log level to Debug for /metrics requests Signed-off-by: Dave Henderson <dhenderson@gmail.com> * Apply suggestions from code review Co-authored-by: Matt Holt <mholt@users.noreply.github.com> Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
Dave Henderson committed
Sep 25, 2020 at 20:00 UTC
85152679ce910d0993a2902ec00d199b8cc14e4d
1 file changed
+6
-1
admin.go
+6
-1
@@ -311,13 +311,18 @@ type adminHandler struct {
311
// ServeHTTP is the external entry point for API requests.
312
// It will only be called once per request.
313
func (h adminHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
314
- Log().Named("admin.api").Info("received request",
314
+ log := Log().Named("admin.api").With(
315
zap.String("method", r.Method),
316
zap.String("host", r.Host),
317
zap.String("uri", r.RequestURI),
318
zap.String("remote_addr", r.RemoteAddr),
319
zap.Reflect("headers", r.Header),
320
)
321
+ if r.RequestURI == "/metrics" {
322
+ log.Debug("received request")
323
+ } else {
324
+ log.Info("received request")
325
+ }
326
h.serveHTTP(w, r)
327
}
328