From cafce4d9a0c7b824430475188c94900122e2d158 Mon Sep 17 00:00:00 2001 From: miampf Date: Wed, 31 Jan 2024 16:17:36 +0100 Subject: [PATCH] also add source to Test logger --- internal/logger/log.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/logger/log.go b/internal/logger/log.go index 75b76e08f68..33a298b1f91 100644 --- a/internal/logger/log.go +++ b/internal/logger/log.go @@ -107,7 +107,7 @@ func NewJSONLogger(level slog.Level) *slog.Logger { // NewTest creates a new slog.Logger that writes to a testing.T. func NewTest(t *testing.T) *slog.Logger { - return slog.New(slog.NewTextHandler(testWriter{t: t}, nil)) + return slog.New(slog.NewTextHandler(testWriter{t: t}, &slog.HandlerOptions{AddSource: true})) } // TestWriter is a writer to a testing.T used in tests for logging with slog.