package textlogger
import "k8s.io/klog/v2/textlogger"
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 ¶
Variables ¶
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 ¶
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 ¶
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 ¶
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.
Source Files ¶
options.go textlogger.go
- Version
- v2.50.0
- Published
- Mar 15, 2022
- Platform
- linux/amd64
- Imports
- 12 packages
- Last checked
- 19 hours ago –
Tools for package owners.