slogdiscard

package
v0.0.0-...-bae6b6e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDiscardLogger

func NewDiscardLogger() *slog.Logger

NewDiscardLogger creates a new logger that discards all log records.

Types

type DiscardHandler

type DiscardHandler struct{}

DiscardHandler is a logger handler that discards all log records.

func NewDiscardHandler

func NewDiscardHandler() *DiscardHandler

NewDiscardHandler creates a new DiscardHandler instance.

func (*DiscardHandler) Enabled

func (h *DiscardHandler) Enabled(_ context.Context, _ slog.Level) bool

Enabled returns false since DiscardHandler does not enable any log levels.

func (*DiscardHandler) Handle

func (h *DiscardHandler) Handle(_ context.Context, _ slog.Record) error

Handle ignores the log record.

func (*DiscardHandler) WithAttrs

func (h *DiscardHandler) WithAttrs(_ []slog.Attr) slog.Handler

WithAttrs returns the handler itself since DiscardHandler does not use attributes.

func (*DiscardHandler) WithGroup

func (h *DiscardHandler) WithGroup(_ string) slog.Handler

WithGroup returns the handler itself since DiscardHandler does not use groups.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL