handler

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MtlogLevelToSlog

func MtlogLevelToSlog(level core.LogEventLevel) slog.Level

MtlogLevelToSlog converts mtlog levels to slog levels

Types

type SlogHandler

type SlogHandler struct {
	// contains filtered or unexported fields
}

SlogHandler implements slog.Handler backed by mtlog's logger

func NewSlogHandler

func NewSlogHandler(logger core.Logger) *SlogHandler

NewSlogHandler creates a new slog.Handler that writes to the provided mtlog logger

func (*SlogHandler) Enabled

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

Enabled reports whether the handler handles records at the given level

func (*SlogHandler) Handle

func (h *SlogHandler) Handle(ctx context.Context, record slog.Record) error

Handle handles the Record

func (*SlogHandler) WithAttrs

func (h *SlogHandler) WithAttrs(attrs []slog.Attr) slog.Handler

WithAttrs returns a new Handler whose attributes consist of both the receiver's attributes and the arguments

func (*SlogHandler) WithGroup

func (h *SlogHandler) WithGroup(name string) slog.Handler

WithGroup returns a new Handler with the given group appended to the receiver's existing groups

Jump to

Keyboard shortcuts

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