Help us shape the future of Go! Take the 2026 Go Developer Survey

logger

package
v0.113.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultLogger

func NewDefaultLogger(service string) zerolog.Logger

func NewStdErr

func NewStdErr(cf *shared.LoggerConfigFile, service string) zerolog.Logger

NewStdErr creates a logger that writes to os.Stderr, unless the config carries a runtime writer override (cf.Writer), in which case output is routed there instead.

func NewWithWriter added in v0.106.11

func NewWithWriter(cf *shared.LoggerConfigFile, service string, w io.Writer) zerolog.Logger

NewWithWriter creates a logger that writes to w in the configured format (console or json). The explicit writer always wins: any cf.Writer override is ignored. w must be non-nil.

func ShutdownAware added in v0.107.0

func ShutdownAware(ctx context.Context, l *zerolog.Logger, err error, level zerolog.Level) *zerolog.Event

ShutdownAware returns an event on l at level, demoted to debug when err is the cancellation produced by ctx being canceled during a graceful shutdown, as opposed to a real failure, which keeps logging at level. Both the governing context and the error must be canceled specifically: a deadline error always logs at its original level, so a genuine timeout is never hidden.

Types

This section is empty.

Jump to

Keyboard shortcuts

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