Add config to not log requests to metrics endpoint
This commit is contained in:
@@ -17,12 +17,10 @@ func (s *Server) LoggingMiddleware(next http.Handler) http.Handler {
|
||||
reqID := middleware.GetReqID(r.Context())
|
||||
|
||||
defer func() {
|
||||
/*s.AccessLogger.Debugw(r.Method,
|
||||
"path", r.URL.Path,
|
||||
"request-headers", r.Header,
|
||||
"response-headers", ww.Header(),
|
||||
)
|
||||
*/
|
||||
// If AccessLogIgnoreMetrics is true, do not log successful requests to metrics endpoint
|
||||
if s.cfg.AccessLogIgnoreMetrics && r.URL.Path == "/metrics" && ww.Status() == http.StatusOK {
|
||||
return
|
||||
}
|
||||
s.AccessLogger.Infow(r.Method,
|
||||
"path", r.URL.Path,
|
||||
"status", ww.Status(),
|
||||
|
Reference in New Issue
Block a user