skip logging for health check

This commit is contained in:
Andre Medeiros 2021-08-14 11:34:32 -04:00
parent bcb53235f8
commit 50cdc3aafa

View file

@ -114,6 +114,12 @@ func (lrw *LoggingResponseWriter) WriteHeader(statusCode int) {
func (a *api) loggingMiddleware(next http.Handler) http.Handler { func (a *api) loggingMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 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() start := time.Now()
lrw := &LoggingResponseWriter{w: w} lrw := &LoggingResponseWriter{w: w}
// Do stuff here // Do stuff here