From 3d560cc5d8aab48821a795a6ab4f1d48fdd7738f Mon Sep 17 00:00:00 2001 From: "Grail Finder (aider)" Date: Fri, 2 May 2025 09:46:51 +0300 Subject: [PATCH] feat: configure structured JSON logging with debug level --- handlers/handlers.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/handlers/handlers.go b/handlers/handlers.go index da65ba5..882ffc8 100644 --- a/handlers/handlers.go +++ b/handlers/handlers.go @@ -4,11 +4,14 @@ import ( "html/template" "log/slog" "net/http" + "os" ) func init() { - // init slog to be at level debug and us json structured logs; ai! - slog = slog.New() + handler := slog.NewJSONHandler(os.Stderr, &slog.HandlerOptions{ + Level: slog.LevelDebug, + }) + slog = slog.New(handler) } var roundWords = map[string]string{