From 50cdc3aafa5beed72c1558c8cdd4bb4df2ae4efd Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Sat, 14 Aug 2021 11:34:32 -0400 Subject: [PATCH] skip logging for health check --- internal/api/api.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/api/api.go b/internal/api/api.go index c8999f9..5e104ff 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -114,6 +114,12 @@ func (lrw *LoggingResponseWriter) WriteHeader(statusCode int) { func (a *api) loggingMiddleware(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // Skip logging health checks + if r.RequestURI == "/v1/health" { + next.ServeHTTP(w, r) + return + } + start := time.Now() lrw := &LoggingResponseWriter{w: w} // Do stuff here