logging

package
v0.3.21 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HookHandler

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

func NewHookHandler

func NewHookHandler(opts *HookHandlerOptions) *HookHandler

func (*HookHandler) Enabled

func (h *HookHandler) Enabled(ctx context.Context, level slog.Level) bool

func (*HookHandler) Handle

func (h *HookHandler) Handle(ctx context.Context, r slog.Record) error

func (*HookHandler) SetLevel

func (h *HookHandler) SetLevel(level slog.Level)

func (*HookHandler) WithAttrs

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

func (*HookHandler) WithGroup

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

type HookHandlerOptions

type HookHandlerOptions struct {
	Level     slog.Leveler
	WriteFunc func(ctx context.Context, record *Record) error
}

type Level

type Level string
const (
	LevelDebug Level = "DEBUG"
	LevelInfo  Level = "INFO"
	LevelWarn  Level = "WARN"
	LevelError Level = "ERROR"
)

func (Level) Level

func (l Level) Level() slog.Level

func (Level) String

func (l Level) String() string

type Record

type Record struct {
	Time    time.Time
	Level   Level
	Message string
	Data    types.JSONMap[any]
}

Jump to

Keyboard shortcuts

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