logging

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT = 2
	VERBOSE = 3
	DEBUG   = 4
	TRACE   = 5
)
View Source
const (
	ZapLogLevelFlagName = "zap-log-level"
)

Variables

This section is empty.

Functions

func InitLogging

func InitLogging(opts *zap.Options)

func InitSetupLogging

func InitSetupLogging()

func NewTestLogger

func NewTestLogger() logr.Logger

NewTestLogger creates a new Zap logger using the dev mode.

func NewTestLoggerIntoContext

func NewTestLoggerIntoContext(ctx context.Context) context.Context

NewTestLoggerIntoContext creates a new Zap logger using the dev mode and inserts it into the given context.

func NewTestLoggerWithWriter

func NewTestLoggerWithWriter(w io.Writer) logr.Logger

NewTestLoggerWithWriter creates a new Zap logger using the dev mode.

Types

type LoggingOptions

type LoggingOptions struct {
	LogVerbosity int         // Number for the log level verbosity.
	ZapOptions   zap.Options // Zap logging options.
	// contains filtered or unexported fields
}

LoggingOptions contains logging configuration for command-line flags.

func NewOptions

func NewOptions() *LoggingOptions

NewOptions returns a new LoggingOptions struct initialized with default values.

func (*LoggingOptions) AddFlags

func (opts *LoggingOptions) AddFlags(fs *pflag.FlagSet)

AddFlags binds the LoggingOptions fields to command-line flags on the given FlagSet.

func (*LoggingOptions) Complete

func (opts *LoggingOptions) Complete() error

Complete performs post-processing of parsed command-line arguments. Derives the zap log level from the -v flag when --zap-log-level is not set explicitly.

func (*LoggingOptions) Validate

func (opts *LoggingOptions) Validate() error

Validate checks the LoggingOptions for invalid values.

Jump to

Keyboard shortcuts

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