package logs
import "k8s.io/component-base/logs"
Index ¶
- func AddFlags(fs *pflag.FlagSet)
- func FlushLogs()
- func GlogSetter(val string) (string, error)
- func InitLogs()
- func NewLogger(prefix string) *log.Logger
- type KlogWriter
- type LogFormatRegistry
- func NewLogFormatRegistry() *LogFormatRegistry
- func (lfr *LogFormatRegistry) Delete(name string) error
- func (lfr *LogFormatRegistry) Freeze()
- func (lfr *LogFormatRegistry) Get(name string) (logr.Logger, error)
- func (lfr *LogFormatRegistry) List() []string
- func (lfr *LogFormatRegistry) Register(name string, logger logr.Logger) error
- func (lfr *LogFormatRegistry) Set(name string, logger logr.Logger) error
- type Options
Functions ¶
func AddFlags ¶
AddFlags registers this package's flags on arbitrary FlagSets, such that they point to the same value as the global flags.
func FlushLogs ¶
func FlushLogs()
FlushLogs flushes logs immediately.
func GlogSetter ¶
GlogSetter is a setter to set glog level.
func InitLogs ¶
func InitLogs()
InitLogs initializes logs the way we want for kubernetes.
func NewLogger ¶
NewLogger creates a new log.Logger which sends logs to klog.Info.
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 ¶
type LogFormatRegistry struct {
// contains filtered or unexported fields
}
LogFormatRegistry store klog format registry
func NewLogFormatRegistry ¶
func NewLogFormatRegistry() *LogFormatRegistry
NewLogFormatRegistry return new init LogFormatRegistry struct
func (*LogFormatRegistry) Delete ¶
func (lfr *LogFormatRegistry) Delete(name string) error
Delete specified log format logger
func (*LogFormatRegistry) Freeze ¶
func (lfr *LogFormatRegistry) Freeze()
Freeze freezes the log format registry
func (*LogFormatRegistry) Get ¶
func (lfr *LogFormatRegistry) Get(name string) (logr.Logger, error)
Get specified log format logger
func (*LogFormatRegistry) List ¶
func (lfr *LogFormatRegistry) List() []string
List names of registered log formats (sorted)
func (*LogFormatRegistry) Register ¶
func (lfr *LogFormatRegistry) Register(name string, logger logr.Logger) error
Register new log format registry to global logRegistry
func (*LogFormatRegistry) Set ¶
func (lfr *LogFormatRegistry) Set(name string, logger logr.Logger) error
Set specified log format logger
type Options ¶
Options has klog format parameters
func NewOptions ¶
func NewOptions() *Options
NewOptions return new klog options
func (*Options) AddFlags ¶
AddFlags add logging-format flag
func (*Options) Apply ¶
func (o *Options) Apply()
Apply set klog logger from LogFormat type
func (*Options) Get ¶
Get logger with LogFormat field
func (*Options) Validate ¶
Validate verifies if any unsupported flag is set for non-default logging format
Source Files ¶
logs.go options.go registry.go
Directories ¶
Path | Synopsis |
---|---|
logs/datapol | Package datapol contains functions to determine if objects contain sensitive data to e.g. |
logs/json | |
logs/logreduction | |
logs/sanitization |
- Version
- v0.20.0-rc.0
- Published
- Dec 2, 2020
- Platform
- js/wasm
- Imports
- 12 packages
- Last checked
- 10 seconds ago –
Tools for package owners.