zen/core/zlog/null.go

15 lines
389 B
Go
Raw Normal View History

2024-08-23 10:18:27 +07:00
package zlog
2024-08-23 12:29:47 +07:00
import (
"context"
"log/slog"
)
// Null is a no-op log handler.
type Null struct{}
func (Null) Enabled(context.Context, slog.Level) bool { return false }
func (Null) Handle(context.Context, slog.Record) error { return nil }
func (Null) WithAttrs([]slog.Attr) slog.Handler { return Null{} }
func (nu Null) WithGroup(string) slog.Handler { return Null{} }