Documentation
¶
Index ¶
Constants ¶
View Source
const ( FormatText = "text" FormatJSON = "json" )
Variables ¶
View Source
var ErrNotFoundHandler = errors.New("not found handler")
Functions ¶
func Get ¶
Get returns a slog.Handler for the given kind and format. It first checks handler factories, then tries to build one from a registered writer.
func RegisterHandlerFunc ¶ added in v1.2.1
func RegisterHandlerFunc(kind string, fn HandlerFunc)
RegisterHandlerFunc registers a handler factory for the given output kind. The factory produces a complete slog.Handler — format parameter is ignored.
func RegisterWriter ¶
func RegisterWriter(kind string, fn WriterFunc)
RegisterWriter registers a writer factory for the given output kind. The writer will be wrapped in slog.JSONHandler or slog.TextHandler based on format.
Types ¶
type HandlerFunc ¶ added in v1.2.1
HandlerFunc is a factory that returns a pre-built slog.Handler directly. Used by outputs (e.g. OTEL, Datadog) that manage their own handler construction.
type WriterFunc ¶ added in v1.2.1
type WriterFunc func() (io.Writer, *slog.HandlerOptions, error)
WriterFunc is a factory that returns an io.Writer and optional handler options.
Click to show internal directories.
Click to hide internal directories.