From 406476fbfc2752aa7e399e14a2a9e6be08a101ec Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 3 Apr 2025 08:25:43 -0600 Subject: refactor: remove slog-http --- pkg/log/init.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'pkg/log/init.go') diff --git a/pkg/log/init.go b/pkg/log/init.go index 43ec5ab4..7d9456b6 100644 --- a/pkg/log/init.go +++ b/pkg/log/init.go @@ -1,12 +1,12 @@ package log import ( + "fmt" "log" "log/slog" "net/http" "os" - sloghttp "github.com/samber/slog-http" "github.com/xlgmokha/x/pkg/env" ) @@ -24,6 +24,7 @@ type Fields map[string]interface{} func WithFields(r *http.Request, fields Fields) { for key, value := range fields { - sloghttp.AddCustomAttributes(r, slog.Any(key, value)) + attr := slog.String(key, fmt.Sprintf("%v", value)) + Logger.LogAttrs(r.Context(), slog.LevelDebug, "x", attr) } } -- cgit v1.2.3