goshort/internal/util/logging/noop.go
Gustavo Maronato be39b22ace
Some checks failed
Check / checks (push) Failing after 3m48s
lint
2024-03-09 05:53:28 -05:00

29 lines
550 B
Go

package logging
import (
"context"
"log/slog"
)
type NoOpHandler struct{}
func NewNoOpHandler() *NoOpHandler {
return &NoOpHandler{}
}
func (h *NoOpHandler) Enabled(_ context.Context, _ slog.Level) bool {
return false
}
func (h *NoOpHandler) Handle(_ context.Context, _ slog.Record) error { //nolint:gocritic // This is the signature of the interface.
return nil
}
func (h *NoOpHandler) WithAttrs(_ []slog.Attr) slog.Handler {
return NewNoOpHandler()
}
func (h *NoOpHandler) WithGroup(_ string) slog.Handler {
return NewNoOpHandler()
}