logs

package
v0.22.6-rc.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: Apache-2.0 Imports: 14 Imported by: 1,014

Documentation

Index

Constants

View Source
const (
	DefaultLogFormat = "text"
	JSONLogFormat    = "json"
)

Supported klog formats

Variables

View Source
var LogRegistry = NewLogFormatRegistry()

LogRegistry is new init LogFormatRegistry struct

Functions

func AddFlags

func AddFlags(fs *pflag.FlagSet)

AddFlags registers this package's flags on arbitrary FlagSets, such that they point to the same value as the global flags.

func BindLoggingFlags added in v0.22.0

func BindLoggingFlags(c *config.LoggingConfiguration, fs *pflag.FlagSet)

BindLoggingFlags binds the Options struct fields to a flagset

func FlushLogs

func FlushLogs()

FlushLogs flushes logs immediately.

func GlogSetter

func GlogSetter(val string) (string, error)

GlogSetter is a setter to set glog level.

func InitLogs

func InitLogs()

InitLogs initializes logs the way we want for kubernetes.

func NewLogger

func NewLogger(prefix string) *log.Logger

NewLogger creates a new log.Logger which sends logs to klog.Info.

func UnsupportedLoggingFlags added in v0.22.0

func UnsupportedLoggingFlags(normalizeFunc func(name string) string) []string

UnsupportedLoggingFlags lists unsupported logging flags

func ValidateLoggingConfiguration added in v0.22.0

func ValidateLoggingConfiguration(c *config.LoggingConfiguration, fldPath *field.Path) field.ErrorList

Types

type KlogWriter

type KlogWriter struct{}

KlogWriter serves as a bridge between the standard log package and the glog package.

func (KlogWriter) Write

func (writer KlogWriter) Write(data []byte) (n int, err error)

Write implements the io.Writer interface.

type LogFormatRegistry added in v0.19.0

type LogFormatRegistry struct {
	// contains filtered or unexported fields
}

LogFormatRegistry store klog format registry

func NewLogFormatRegistry added in v0.19.0

func NewLogFormatRegistry() *LogFormatRegistry

NewLogFormatRegistry return new init LogFormatRegistry struct

func (*LogFormatRegistry) Delete added in v0.19.0

func (lfr *LogFormatRegistry) Delete(name string) error

Delete specified log format logger

func (*LogFormatRegistry) Freeze added in v0.19.0

func (lfr *LogFormatRegistry) Freeze()

Freeze freezes the log format registry

func (*LogFormatRegistry) Get added in v0.19.0

func (lfr *LogFormatRegistry) Get(name string) (logr.Logger, error)

Get specified log format logger

func (*LogFormatRegistry) List added in v0.19.0

func (lfr *LogFormatRegistry) List() []string

List names of registered log formats (sorted)

func (*LogFormatRegistry) Register added in v0.19.0

func (lfr *LogFormatRegistry) Register(name string, logger logr.Logger) error

Register new log format registry to global logRegistry

func (*LogFormatRegistry) Set added in v0.19.0

func (lfr *LogFormatRegistry) Set(name string, logger logr.Logger) error

Set specified log format logger

type Options added in v0.19.0

type Options struct {
	Config config.LoggingConfiguration
}

Options has klog format parameters

func NewOptions added in v0.19.0

func NewOptions() *Options

NewOptions return new klog options

func (*Options) AddFlags added in v0.19.0

func (o *Options) AddFlags(fs *pflag.FlagSet)

AddFlags add logging-format flag

func (*Options) Apply added in v0.19.0

func (o *Options) Apply()

Apply set klog logger from LogFormat type

func (*Options) Validate added in v0.19.0

func (o *Options) Validate() []error

Validate verifies if any unsupported flag is set for non-default logging format

Directories

Path Synopsis
Package datapol contains functions to determine if objects contain sensitive data to e.g.
Package datapol contains functions to determine if objects contain sensitive data to e.g.
example
cmd

Jump to

Keyboard shortcuts

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