| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | package oidc |
||
| 2 | |||
| 3 | import ( |
||
| 4 | "log/slog" |
||
| 5 | ) |
||
| 6 | |||
| 7 | // SlogAdapter adapts the slog.Logger to be compatible with retryablehttp.LeveledLogger. |
||
| 8 | type SlogAdapter struct { |
||
| 9 | Logger *slog.Logger |
||
| 10 | } |
||
| 11 | |||
| 12 | // Error logs messages at error level. |
||
| 13 | func (a SlogAdapter) Error(msg string, keysAndValues ...interface{}) { |
||
| 14 | a.Logger.Error(msg, keysAndValues...) |
||
| 15 | } |
||
| 16 | |||
| 17 | // Info logs messages at info level. |
||
| 18 | func (a SlogAdapter) Info(msg string, keysAndValues ...interface{}) { |
||
| 19 | a.Logger.Info(msg, keysAndValues...) |
||
| 20 | } |
||
| 21 | |||
| 22 | // Debug logs messages at debug level. |
||
| 23 | func (a SlogAdapter) Debug(msg string, keysAndValues ...interface{}) { |
||
| 24 | a.Logger.Info(msg, keysAndValues...) |
||
| 25 | } |
||
| 26 | |||
| 27 | // Warn logs messages at warn level. |
||
| 28 | func (a SlogAdapter) Warn(msg string, keysAndValues ...interface{}) { |
||
| 29 | a.Logger.Warn(msg, keysAndValues...) |
||
| 30 | } |
||
| 31 |