logger

package
v0.9.9 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(outlets *Outlets) *slog.Logger

func NewNullLogger

func NewNullLogger() *slog.Logger

func NewTestLogger

func NewTestLogger(t *testing.T) *slog.Logger

func WithError added in v0.9.2

func WithError(l *slog.Logger, err error, msg string) *slog.Logger

Types

type Outlets

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

func NewOutlets

func NewOutlets() *Outlets

func (*Outlets) Add

func (self *Outlets) Add(outlet slog.Handler) *Outlets

func (*Outlets) Enabled added in v0.9.2

func (self *Outlets) Enabled(ctx context.Context, level slog.Level) bool

func (*Outlets) GetLoggerErrorOutlet

func (self *Outlets) GetLoggerErrorOutlet() slog.Handler

Return the first outlet added to this Outlets list using Add() with minLevel <= Error. If no such outlet is in this Outlets list, a discarding outlet is returned.

func (*Outlets) Handle added in v0.9.2

func (self *Outlets) Handle(ctx context.Context, r slog.Record) error

func (*Outlets) WithAttrs added in v0.9.2

func (self *Outlets) WithAttrs(attrs []slog.Attr) slog.Handler

func (*Outlets) WithGroup added in v0.9.2

func (self *Outlets) WithGroup(name string) slog.Handler

Jump to

Keyboard shortcuts

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