textlogger

package
v2.80.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: Apache-2.0 Imports: 12 Imported by: 42

Documentation

Overview

Package textlogger contains an implementation of the logr interface which is producing the exact same output as klog.

Experimental

Notice: This package is EXPERIMENTAL and may be changed or removed in a later release.

Index

Constants

This section is empty.

Variables

View Source
var (
	// TimeNow is used to retrieve the current time. May be changed for testing.
	//
	// Experimental
	//
	// Notice: This variable is EXPERIMENTAL and may be changed or removed in a
	// later release.
	TimeNow = time.Now
)

Functions

func NewLogger

func NewLogger(c *Config) logr.Logger

NewLogger constructs a new logger.

Experimental

Notice: This function is EXPERIMENTAL and may be changed or removed in a later release. The behavior of the returned Logger may change.

Types

type Config

type Config struct {
	*verbosity.VState
	// contains filtered or unexported fields
}

Config influences logging in a text logger. To make this configurable via command line flags, instantiate this once per program and use AddFlags to bind command line flags to the instance before passing it to NewTestContext.

Must be constructed with NewConfig.

Experimental

Notice: This type is EXPERIMENTAL and may be changed or removed in a later release.

func NewConfig

func NewConfig(opts ...ConfigOption) *Config

NewConfig returns a configuration with recommended defaults and optional modifications. Command line flags are not bound to any FlagSet yet.

Experimental

Notice: This function is EXPERIMENTAL and may be changed or removed in a later release.

func (*Config) AddFlags

func (c *Config) AddFlags(fs *flag.FlagSet)

AddFlags registers the command line flags that control the configuration.

Experimental

Notice: This function is EXPERIMENTAL and may be changed or removed in a later release.

type ConfigOption

type ConfigOption func(co *configOptions)

ConfigOption implements functional parameters for NewConfig.

Experimental

Notice: This type is EXPERIMENTAL and may be changed or removed in a later release.

func Output

func Output(output io.Writer) ConfigOption

Output overrides stderr as the output stream.

Experimental

Notice: This function is EXPERIMENTAL and may be changed or removed in a later release.

func VModuleFlagName

func VModuleFlagName(name string) ConfigOption

VModulFlagName overrides the default -vmodule for the per-module verbosity levels.

Experimental

Notice: This function is EXPERIMENTAL and may be changed or removed in a later release.

func Verbosity

func Verbosity(level int) ConfigOption

Verbosity overrides the default verbosity level of 0. See https://github.com/kubernetes/community/blob/9406b4352fe2d5810cb21cc3cb059ce5886de157/contributors/devel/sig-instrumentation/logging.md#logging-conventions for log level conventions in Kubernetes.

Experimental

Notice: This function is EXPERIMENTAL and may be changed or removed in a later release.

func VerbosityFlagName

func VerbosityFlagName(name string) ConfigOption

VerbosityFlagName overrides the default -v for the verbosity level.

Jump to

Keyboard shortcuts

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