From 66bf81b948561f8e897343559701236bcce9e4fd Mon Sep 17 00:00:00 2001 From: Adam Fisk Date: Mon, 10 Feb 2025 12:37:38 -0700 Subject: [PATCH] another log fix --- kindling.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kindling.go b/kindling.go index 679be8f..d165fd6 100644 --- a/kindling.go +++ b/kindling.go @@ -33,6 +33,7 @@ type httpDialer func(ctx context.Context, addr string) (http.RoundTripper, error type kindling struct { httpDialers []httpDialer rootCA string + logWriter io.Writer } // Make sure that kindling implements the Kindling interface. @@ -43,7 +44,10 @@ type Option func(*kindling) // NewKindling returns a new Kindling. func NewKindling(options ...Option) Kindling { - k := &kindling{} + k := &kindling{ + logWriter: os.Stdout, + } + // Apply all the functional options to configure the client. for _, opt := range options { opt(k) @@ -85,6 +89,7 @@ func WithRootCA(rootCA string) Option { // This should be the first option to be applied to the Kindling to ensure that all logs are captured. func WithLogWriter(w io.Writer) Option { return func(k *kindling) { + k.logWriter = w log = slog.New(slog.NewTextHandler(w, &slog.HandlerOptions{})) } }