logger

package
v0.1.34 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LogLevel holds the logging level from --log-level flag.
	// Set by commands that call PreRunESetup().
	LogLevel string

	// LogOutput holds the log output destination from --log-output flag.
	// Set by commands that call PreRunESetup().
	LogOutput string

	// Logger is the configured global logger instance.
	// Configured in PreRunESetup() based on LogLevel and LogOutput values.
	Logger polylog.Logger
)

Functions

func NewSetupConsoleWriter

func NewSetupConsoleWriter(logWriter io.Writer) func(zlog *zerolog.Logger)

NewSetupConsoleWriter returns a polylog setup function which wraps the underlying zerolog logger in a ConsoleWriter, for prettier output. The console writer is configured to exclude the timestamp field, and to exclude the log level output for the info level to reduce output verbosity. See: https://github.com/rs/zerolog/?tab=readme-ov-file#pretty-logging.

func PreRunESetup

func PreRunESetup(cmd *cobra.Command, _ []string) error

PreRunESetup configures the global Logger based on LogLevel and LogOutput values. Should be called from (or by) a Cobra command's PreRunE function. Features: • Thread-safe, non-blocking logging via diode wrapper • Supports stdout, stderr, discard, or file output • Sets logger on command context

TODO_CONSIDERATION: Apply this pattern to all CLI commands.

Types

This section is empty.

Jump to

Keyboard shortcuts

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