logger

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	Key   string
	Value any
}

Field represents a key-value pair for structured logging.

func Attr

func Attr(key string, value any) Field

Attr creates a Field with the given key and value.

func Err

func Err(err error) Field

Err creates a Field for an error with the standard "error" key.

type Logger

type Logger interface {
	Info(ctx context.Context, msg string, fields ...Field)
	Debug(ctx context.Context, msg string, fields ...Field)
	Error(ctx context.Context, msg string, fields ...Field)
}

Logger is an interface for logging that supports Info, Debug, and Error operations.

func NewFromSlog

func NewFromSlog(sl *slog.Logger) Logger

NewFromSlog wraps a slog.Logger to satisfy the Logger interface.

func NewFromZerolog

func NewFromZerolog(zl *zerolog.Logger) Logger

NewFromZerolog wraps a zerolog.Logger to satisfy the Logger interface.

func Nop

func Nop() Logger

Nop returns a no-op logger that discards all output.

Jump to

Keyboard shortcuts

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