mirror of
https://github.com/spf13/viper
synced 2024-11-16 18:07:02 +00:00
7162e9244e
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
31 lines
544 B
Go
31 lines
544 B
Go
package viper
|
|
|
|
import (
|
|
"context"
|
|
"log/slog"
|
|
)
|
|
|
|
// WithLogger sets a custom logger.
|
|
func WithLogger(l *slog.Logger) Option {
|
|
return optionFunc(func(v *Viper) {
|
|
v.logger = l
|
|
})
|
|
}
|
|
|
|
type discardHandler struct{}
|
|
|
|
func (n *discardHandler) Enabled(_ context.Context, _ slog.Level) bool {
|
|
return false
|
|
}
|
|
|
|
func (n *discardHandler) Handle(_ context.Context, _ slog.Record) error {
|
|
return nil
|
|
}
|
|
|
|
func (n *discardHandler) WithAttrs(_ []slog.Attr) slog.Handler {
|
|
return n
|
|
}
|
|
|
|
func (n *discardHandler) WithGroup(_ string) slog.Handler {
|
|
return n
|
|
}
|