Documentation ¶
Index ¶
- Constants
- func Background() context.Context
- func ClientLogger(name string) logr.Logger
- func ControllerLogger(name string) logr.Logger
- func Error(err error, msg string, keysAndValues ...interface{})
- func FromContext(ctx context.Context, keysAndValues ...interface{}) (logr.Logger, error)
- func GlobalLogger() logr.Logger
- func Info(msg string, keysAndValues ...interface{})
- func InitFlags(flags *flag.FlagSet)
- func IntoBackground(log logr.Logger) context.Context
- func IntoContext(ctx context.Context, log logr.Logger) context.Context
- func IntoTODO(log logr.Logger) context.Context
- func Setup(logFormat string, loggingTimestampFormat string, level int) error
- func StdLogger(logger logr.Logger, prefix string) *stdlog.Logger
- func TODO() context.Context
- func V(level int) logr.Logger
- func WithName(name string) logr.Logger
- func WithValues(keysAndValues ...interface{}) logr.Logger
Constants ¶
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 ¶
Background calls IntoContext with the global logger and a Background context.
func ClientLogger ¶ added in v1.9.0
ClientLogger returns a logr.Logger to be used by clients.
func ControllerLogger ¶
ControllerLogger returns a logr.Logger to be used by controllers.
func FromContext ¶
FromContext returns a logger with predefined values from a context.Context.
func GlobalLogger ¶
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 IntoBackground ¶
IntoBackground calls IntoContext with the logger and a Background context.
func IntoContext ¶
IntoContext takes a context and sets the logger as one of its values. Use FromContext function to retrieve the logger.
func Setup ¶
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 WithName ¶
WithName returns a new logr.Logger instance with the specified name element added to the Logger's name.
func WithValues ¶
WithValues returns a new logr.Logger instance with additional key/value pairs.
Types ¶
This section is empty.