logger

package
v0.1.26 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LogLevel is a global variable that is intended to hold the value of the
	// "--log-level" flag when a command which has called PreRunESetup() is executed.
	LogLevel string

	// LogOutput is a global variable that is intended to hold the value of the
	// "--log-output" flag when a command which has called PreRunESetup() is executed.
	LogOutput string

	// Logger is a global variable that holds the logger which is configured according
	// to the values of the LogLevel and LogOutput global variables in PreRunESetup().
	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(_ *cobra.Command, _ []string) error

PreRunESetup sets up the global cmd logger (Logger) for use in any subcommand. This function is intended to be passed as (or called by) a `PreRunE` function of a Cobra command.

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