log

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level int

Level controls which messages are emitted.

const (
	LevelSilent Level = iota
	LevelError
	LevelInfo
	LevelDebug
)

func ParseLevel

func ParseLevel(s string) Level

ParseLevel converts a string to a Level. Returns LevelInfo for unknown values.

type Logger

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

Logger is a minimal structured logger that writes to stderr. Zero-dependency, safe for concurrent use.

func New

func New(level Level) *Logger

New creates a logger at the given level, writing to stderr.

func Nop

func Nop() *Logger

Nop returns a silent logger that discards all output.

func (*Logger) Debug

func (l *Logger) Debug(msg string, args ...any)

Debug logs at debug level.

func (*Logger) Error

func (l *Logger) Error(msg string, args ...any)

Error logs at error level.

func (*Logger) Info

func (l *Logger) Info(msg string, args ...any)

Info logs at info level.

func (*Logger) Level

func (l *Logger) Level() Level

Level returns the current log level.

func (*Logger) WithOutput

func (l *Logger) WithOutput(w io.Writer) *Logger

WithOutput returns a new logger writing to a different writer.

Jump to

Keyboard shortcuts

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