Use *slog.Logger instead of slog.Logger in option (#74)

* Use *slog.Logger instead of slog.Logger in option

* Update common_client.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Nikola Jokic
2026-02-18 19:15:23 +01:00
committed by GitHub
parent f9f801fb38
commit 0488917cf3
+6 -2
View File
@@ -146,9 +146,13 @@ func (c *commonClient) setUserAgent() {
type HTTPOption func(*httpClientOption)
// WithLogger sets a custom logger for the Client.
func WithLogger(logger slog.Logger) HTTPOption {
// If nil is passed, a discard logger will be used.
func WithLogger(logger *slog.Logger) HTTPOption {
return func(c *httpClientOption) {
c.logger = &logger
if logger == nil {
logger = slog.New(slog.DiscardHandler)
}
c.logger = logger
}
}