summaryrefslogtreecommitdiff
path: root/internal/logging/discard.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/logging/discard.go')
-rw-r--r--internal/logging/discard.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/internal/logging/discard.go b/internal/logging/discard.go
new file mode 100644
index 0000000..e827287
--- /dev/null
+++ b/internal/logging/discard.go
@@ -0,0 +1,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
+}