Skip to content

Commit

Permalink
also add source to Test logger
Browse files Browse the repository at this point in the history
  • Loading branch information
miampf committed Jan 31, 2024
1 parent ad90e40 commit cafce4d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/logger/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit cafce4d

Please sign in to comment.