logging

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyLoggerFlags

func ApplyLoggerFlags(cmd *cobra.Command, args []string)

ApplyLoggerFlags configures the logger based on command line flags.

func Context

func Context(ctx context.Context, logger *log.Logger) context.Context

Context returns a new context with the given logger attached

func CreateStyle

func CreateStyle() *log.Styles

CreateStyle creates and returns custom log styles.

func Debug

func Debug(ctx context.Context, msg any, keyvals ...any)

Debug logs a message at the debug level using the logger from the context.

func Debugf

func Debugf(ctx context.Context, format string, args ...any)

Debugf logs a formatted message at the debug level using the logger from the context.

func Default

func Default() *log.Logger

Default returns the default logger.

func Error

func Error(ctx context.Context, msg any, keyvals ...any)

Error logs a message at the error level using the logger from the context.

func Errorf

func Errorf(ctx context.Context, format string, args ...any)

Errorf logs a formatted message at the error level using the logger from the context.

func From

func From(ctx context.Context) *log.Logger

From returns the possible injected logger in the context

func FromPrefix

func FromPrefix(ctx context.Context, prefix string) *log.Logger

FromPrefix returns the possible injected logger in the context, adding the given prefix

func Info

func Info(ctx context.Context, msg any, keyvals ...any)

Info logs a message at the info level using the logger from the context.

func Infof

func Infof(ctx context.Context, format string, args ...any)

Infof logs a formatted message at the info level using the logger from the context.

func Level

func Level() log.Level

func LoggerFlags

func LoggerFlags(pflags *pflag.FlagSet)

LoggerFlags adds logger-related flags to the given flag set.

func Warn

func Warn(ctx context.Context, msg any, keyvals ...any)

Warn logs a message at the warning level using the logger from the context.

func Warnf

func Warnf(ctx context.Context, format string, args ...any)

Warnf logs a formatted message at the warning level using the logger from the context.

func With

func With(ctx context.Context, keyvals ...any) *log.Logger

With returns a logger with the given key-value pairs attached, based on the logger extracted from the provided context.

func WithPrefix

func WithPrefix(ctx context.Context, prefix string) *log.Logger

WithPrefix returns a logger with the given prefix attached, based on the logger extracted from the provided context.

Types

This section is empty.

Jump to

Keyboard shortcuts

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