From 35a092630eddaea48efdd16ce6e7d84cc390c710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sun, 23 May 2021 19:21:36 +0200 Subject: [PATCH] logs ignore healthcheck requests. --- server/internal/http/middleware/logger.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/internal/http/middleware/logger.go b/server/internal/http/middleware/logger.go index b20ea9a..ab19ba2 100644 --- a/server/internal/http/middleware/logger.go +++ b/server/internal/http/middleware/logger.go @@ -13,6 +13,12 @@ func Logger(next http.Handler) http.Handler { fn := func(w http.ResponseWriter, r *http.Request) { req := map[string]interface{}{} + // ignore healthcheck + if r.RequestURI == "/health" { + next.ServeHTTP(w, r) + return + } + if reqID := middleware.GetReqID(r.Context()); reqID != "" { req["id"] = reqID }