mirror of
https://github.com/emo2007/block-accounting.git
synced 2024-11-14 22:26:27 +00:00
33 lines
562 B
Go
33 lines
562 B
Go
|
package logger
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"log/slog"
|
||
|
)
|
||
|
|
||
|
func NewDiscardLogger() *slog.Logger {
|
||
|
return slog.New(NewDiscardHandler())
|
||
|
}
|
||
|
|
||
|
type DiscardHandler struct{}
|
||
|
|
||
|
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
|
||
|
}
|