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

logutils

package
v0.60.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ComponentKey = "cmp"

ComponentKey is the field that names the part of the program a log line comes from. Every component logger carries it, so one filter narrows a log to one component.

Variables

This section is empty.

Functions

func Component added in v0.60.0

func Component(logger zerolog.Logger, name string) zerolog.Logger

Component returns logger with the component label set to name. Give it a logger that has no component label yet: zerolog appends fields, so a second call adds a second cmp key instead of replacing the first.

func New

func New(level string, file string) (zerolog.Logger, func(), error)

New returns a new logger.

If file is set, logs are written to that file in console format. If file is empty, logs are written to stdout in JSON format.

The level parameter can be one of: debug, info, warn, error, fatal.

Types

This section is empty.

Jump to

Keyboard shortcuts

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