logger

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event interface {
	// Field helpers
	Str(key, val string) Event
	Int(key string, val int) Event
	Int64(key string, val int64) Event
	Uint64(key string, val uint64) Event
	Float64(key string, val float64) Event
	Bool(key string, val bool) Event
	Time(key string, t time.Time) Event
	Dur(key string, d time.Duration) Event
	Bytes(key string, b []byte) Event
	Err(err error) Event
	Any(key string, v any) Event

	// Finalize
	Msg(msg string)
}

Event is a one shot builder. Callers add fields, then finish with Msg following Zerolog style

type Logger

type Logger interface {
	With(kv ...any) Logger

	Debug() Event
	Info() Event
	Warn() Event
	Error() Event
}

Logger produces Event builders at specific levels and can attach context fields. Implementations MUST be safe for concurrent use.

func NewSlog

func NewSlog(l *slog.Logger) Logger

func NewZero

func NewZero(l zerolog.Logger) Logger

type Noop

type Noop struct{} // zero-size, safe to copy

func (Noop) Debug

func (Noop) Debug() Event

func (Noop) Error

func (Noop) Error() Event

func (Noop) Info

func (Noop) Info() Event

func (Noop) Warn

func (Noop) Warn() Event

func (Noop) With

func (Noop) With(_ ...any) Logger

With returns itself

Jump to

Keyboard shortcuts

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