From d936e24692940096aa5009776259d88d81fd60d1 Mon Sep 17 00:00:00 2001 From: yusing Date: Mon, 11 Nov 2024 01:32:55 +0800 Subject: [PATCH] moved API request log to debug level --- internal/api/handler.go | 2 +- internal/api/v1/utils/logging.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/api/handler.go b/internal/api/handler.go index 4cf7952..45dd5f9 100644 --- a/internal/api/handler.go +++ b/internal/api/handler.go @@ -54,7 +54,7 @@ func checkHost(f http.HandlerFunc) http.HandlerFunc { http.Error(w, "forbidden", http.StatusForbidden) return } - LogInfo(r).Interface("headers", r.Header).Msg("API request") + LogDebug(r).Interface("headers", r.Header).Msg("API request") f(w, r) } } diff --git a/internal/api/v1/utils/logging.go b/internal/api/v1/utils/logging.go index cdf4222..d8388fd 100644 --- a/internal/api/v1/utils/logging.go +++ b/internal/api/v1/utils/logging.go @@ -16,3 +16,4 @@ func reqLogger(r *http.Request, level zerolog.Level) *zerolog.Event { func LogError(r *http.Request) *zerolog.Event { return reqLogger(r, zerolog.ErrorLevel) } func LogWarn(r *http.Request) *zerolog.Event { return reqLogger(r, zerolog.WarnLevel) } func LogInfo(r *http.Request) *zerolog.Event { return reqLogger(r, zerolog.InfoLevel) } +func LogDebug(r *http.Request) *zerolog.Event { return reqLogger(r, zerolog.DebugLevel) }