logging

package
v1.12.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// JSONFormat represents JSON logging mode.
	JSONFormat = "json"
	// TextFormat represents text logging mode.
	// Default logging mode is TextFormat.
	TextFormat = "text"
	// LogLevelController is the log level to use for controllers plumbing.
	LogLevelController = 1
	// LogLevelClient is the log level to use for clients.
	LogLevelClient = 1
	// time formats
	DefaultTime = "default"
	ISO8601     = "iso8601"
	RFC3339     = "rfc3339"
	MILLIS      = "millis"
	NANOS       = "nanos"
	EPOCH       = "epoch"
	RFC3339NANO = "rfc3339nano"
)

Variables

This section is empty.

Functions

func Background

func Background() context.Context

Background calls IntoContext with the global logger and a Background context.

func ClientLogger added in v1.9.0

func ClientLogger(name string) logr.Logger

ClientLogger returns a logr.Logger to be used by clients.

func ControllerLogger

func ControllerLogger(name string) logr.Logger

ControllerLogger returns a logr.Logger to be used by controllers.

func Error

func Error(err error, msg string, keysAndValues ...interface{})

Error logs an error, with the given message and key/value pairs.

func FromContext

func FromContext(ctx context.Context, keysAndValues ...interface{}) (logr.Logger, error)

FromContext returns a logger with predefined values from a context.Context.

func GlobalLogger

func GlobalLogger() logr.Logger

GlobalLogger returns a logr.Logger as configured in main.

func Info

func Info(msg string, keysAndValues ...interface{})

Info logs a non-error message with the given key/value pairs.

func InitFlags added in v1.9.0

func InitFlags(flags *flag.FlagSet)

func IntoBackground

func IntoBackground(log logr.Logger) context.Context

IntoBackground calls IntoContext with the logger and a Background context.

func IntoContext

func IntoContext(ctx context.Context, log logr.Logger) context.Context

IntoContext takes a context and sets the logger as one of its values. Use FromContext function to retrieve the logger.

func IntoTODO

func IntoTODO(log logr.Logger) context.Context

IntoTODO calls IntoContext with the logger and a TODO context.

func Setup

func Setup(logFormat string, loggingTimestampFormat string, level int) error

Setup configures the logger with the supplied log format. It returns an error if the JSON logger could not be initialized or passed logFormat is not recognized.

func StdLogger

func StdLogger(logger logr.Logger, prefix string) *stdlog.Logger

func TODO

func TODO() context.Context

TODO calls IntoContext with the global logger and a TODO context.

func V

func V(level int) logr.Logger

V returns a new logr.Logger instance for a specific verbosity level.

func WithName

func WithName(name string) logr.Logger

WithName returns a new logr.Logger instance with the specified name element added to the Logger's name.

func WithValues

func WithValues(keysAndValues ...interface{}) logr.Logger

WithValues returns a new logr.Logger instance with additional key/value pairs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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