36 lines
628 B
Go
36 lines
628 B
Go
|
package logger
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"log/slog"
|
||
|
)
|
||
|
|
||
|
//nolint:unused //...
|
||
|
func newDiscardLogger() *slog.Logger {
|
||
|
return slog.New(newDiscardHandler())
|
||
|
}
|
||
|
|
||
|
//nolint:unused //...
|
||
|
type DiscardHandler struct{}
|
||
|
|
||
|
//nolint:unused //...
|
||
|
func newDiscardHandler() *DiscardHandler {
|
||
|
return &DiscardHandler{}
|
||
|
}
|
||
|
|
||
|
func (h *DiscardHandler) Handle(_ context.Context, _ slog.Record) error {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (h *DiscardHandler) WithAttrs(_ []slog.Attr) slog.Handler {
|
||
|
return h
|
||
|
}
|
||
|
|
||
|
func (h *DiscardHandler) WithGroup(_ string) slog.Handler {
|
||
|
return h
|
||
|
}
|
||
|
|
||
|
func (h *DiscardHandler) Enabled(_ context.Context, _ slog.Level) bool {
|
||
|
return false
|
||
|
}
|