log

package
v0.0.0-...-e7c744b Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewErrorStandardLogger

func NewErrorStandardLogger(logger logur.Logger) *log.Logger

NewErrorStandardLogger returns a new standard logger logging on error level.

func NewLogger

func NewLogger(config Config) logur.LoggerFacade

NewLogger creates a new logger.

func NewLogrusLogger

func NewLogrusLogger(config Config) *logrus.Logger

NewLogrusLogger creates a new logrus logger instance.

func SetK8sLogger

func SetK8sLogger(logger logur.Logger)

SetK8sLogger overrides the default klog instance. By default klog tries to write into the filesystem, which doesn't work with scratch containers (there is no /tmp dir), so we override it entirely. See https://github.com/kubernetes/apimachinery/blob/052f7ea/pkg/util/runtime/runtime.go#L78

func SetStandardLogger

func SetStandardLogger(logger logur.Logger)

SetStandardLogger sets the global logger's output to a custom logger instance.

func WithFields

func WithFields(logger logur.Logger, fields map[string]interface{}) logur.LoggerFacade

WithFields returns a new contextual logger instance with context added to it.

Types

type Config

type Config struct {
	// Format specifies the output log format.
	// Accepted values are: json, logfmt/text
	Format string

	// Level is the minimum log level that should appear on the output.
	Level string

	// NoColor makes sure that no log output gets colorized.
	NoColor bool
}

Config holds details necessary for logging.

Jump to

Keyboard shortcuts

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