Documentation
¶
Overview ¶
Package handlers provides simple slog handlers
Index ¶
- func NewDisabled() slog.Handler
- func NewFormat(formatter func(ctx context.Context, r slog.Record) string, writer io.Writer) slog.Handler
- func NewLevel(lvl slog.Leveler, innerHandler slog.Handler) slog.Handler
- func NewLocking(inner slog.Handler) slog.Handler
- func NewMulti(handlers ...slog.Handler) slog.Handler
- type Async
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDisabled ¶
NewDisabled returns a handler which never writes anything.
func NewFormat ¶
func NewFormat(formatter func(ctx context.Context, r slog.Record) string, writer io.Writer) slog.Handler
NewFormat returns a handler that formats records and writes them to an io.Writer.
func NewLocking ¶
NewLocking returns a new locking handler that wraps the given inner handler. Only the Handle method is synchronized, Enabled is not.
Types ¶
type Async ¶
type Async struct {
// contains filtered or unexported fields
}
Async is a slog handler that asynchronously writes logs to another slog handler.
func (*Async) Flush ¶
func (h *Async) Flush()
Flush writes all messages in the queue to the inner handler.
Click to show internal directories.
Click to hide internal directories.