From 869b7ca4c3d5966c826c4997548b8215d97e5918 Mon Sep 17 00:00:00 2001 From: user Date: Sun, 8 Feb 2026 09:15:17 -0800 Subject: [PATCH] fix: replace log.Println with fmt.Fprintln in JSONHandler to prevent deadlock --- json_handler.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/json_handler.go b/json_handler.go index 01226b2..4c1c95b 100644 --- a/json_handler.go +++ b/json_handler.go @@ -3,8 +3,9 @@ package simplelog import ( "context" "encoding/json" - "log" + "fmt" "log/slog" + "os" ) type JSONHandler struct{} @@ -15,7 +16,7 @@ func NewJSONHandler() *JSONHandler { func (j *JSONHandler) Handle(ctx context.Context, record slog.Record) error { jsonData, _ := json.Marshal(record) - log.Println(string(jsonData)) + fmt.Fprintln(os.Stdout, string(jsonData)) return nil } -- 2.45.2