From e97d5c34bc43d6fd7cfc8650cd0e0c08423cf6f3 Mon Sep 17 00:00:00 2001 From: Tolga Ozen Date: Thu, 28 Mar 2024 00:33:44 +0300 Subject: [PATCH] feat(authn): change OIDCSlogAdapter Debug logs to Info level --- internal/authn/oidc/authn.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/authn/oidc/authn.go b/internal/authn/oidc/authn.go index d404719a8..d18f88192 100644 --- a/internal/authn/oidc/authn.go +++ b/internal/authn/oidc/authn.go @@ -44,7 +44,7 @@ type Authn struct { func NewOidcAuthn(ctx context.Context, conf config.Oidc) (*Authn, error) { // Create a new HTTP client with retry capabilities. This client is used for making HTTP requests, particularly for fetching OIDC configuration. client := retryablehttp.NewClient() - client.Logger = SlogAdapter{Logger: slog.Default()} + client.Logger = OIDCSlogAdapter{Logger: slog.Default()} // Fetch the OIDC configuration from the issuer's well-known configuration endpoint. oidcConf, err := fetchOIDCConfiguration(client.StandardClient(), strings.TrimSuffix(conf.Issuer, "/")+"/.well-known/openid-configuration") @@ -296,27 +296,27 @@ func parseOIDCConfiguration(body []byte) (*Config, error) { return &oidcConfig, nil } -// SlogAdapter adapts the slog.Logger to be compatible with retryablehttp.LeveledLogger. -type SlogAdapter struct { +// OIDCSlogAdapter adapts the slog.Logger to be compatible with retryablehttp.LeveledLogger. +type OIDCSlogAdapter struct { Logger *slog.Logger } // Error logs messages at error level. -func (a SlogAdapter) Error(msg string, keysAndValues ...interface{}) { +func (a OIDCSlogAdapter) Error(msg string, keysAndValues ...interface{}) { a.Logger.Error(msg, keysAndValues...) } // Info logs messages at info level. -func (a SlogAdapter) Info(msg string, keysAndValues ...interface{}) { +func (a OIDCSlogAdapter) Info(msg string, keysAndValues ...interface{}) { a.Logger.Info(msg, keysAndValues...) } // Debug logs messages at debug level. -func (a SlogAdapter) Debug(msg string, keysAndValues ...interface{}) { - a.Logger.Debug(msg, keysAndValues...) +func (a OIDCSlogAdapter) Debug(msg string, keysAndValues ...interface{}) { + a.Logger.Info(msg, keysAndValues...) } // Warn logs messages at warn level. -func (a SlogAdapter) Warn(msg string, keysAndValues ...interface{}) { +func (a OIDCSlogAdapter) Warn(msg string, keysAndValues ...interface{}) { a.Logger.Warn(msg, keysAndValues...) }