logging

package
v0.4.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// FormatJSON encodes logs as JSON to stdout.
	FormatJSON = "json"

	// LevelDebug enables debug and above.
	LevelDebug = "debug"
	// LevelInfo enables info and above.
	LevelInfo = "info"
	// LevelWarning enables warning and error only.
	LevelWarning = "warning"
	// LevelError enables error only.
	LevelError = "error"
)

Supported logger formats and levels.

Variables

This section is empty.

Functions

func Debug

func Debug(l log.Logger, kv ...any)

Debug logs at debug level.

func Error

func Error(l log.Logger, kv ...any)

Error logs at error level.

func Info

func Info(l log.Logger, kv ...any)

Info logs at info level.

func NewLogger

func NewLogger(cfg Config) log.Logger

NewLogger builds a go-kit/log Logger using the provided configuration.

func Warn

func Warn(l log.Logger, kv ...any)

Warn logs at warning level.

Types

type Config

type Config struct {
	// Format selects encoder. When set to "json" logs are emitted as JSON to
	// stdout; any other value uses logfmt to stderr.
	Format string
	// Level selects the minimum level to log. Valid values are
	// "debug", "info", "warning", or "error".
	Level string
}

Config declares runtime logging preferences.

Jump to

Keyboard shortcuts

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