summaryrefslogtreecommitdiff
path: root/internal/logging/discard.go
blob: e827287f2dfacc3b2f29f758033f2806741e9bf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package logging

import (
	"context"
	"log/slog"
)

// DiscardHandler discards all log output. DiscardHandler.Enabled returns false for all Levels.
type DiscardHandler struct{}

func (d DiscardHandler) Enabled(ctx context.Context, level slog.Level) bool {
	return false
}

func (d DiscardHandler) Handle(ctx context.Context, record slog.Record) error {
	return nil
}

func (d DiscardHandler) WithAttrs(attrs []slog.Attr) slog.Handler {
	return d
}

func (d DiscardHandler) WithGroup(name string) slog.Handler {
	return d
}