Documentation ¶
Overview ¶
Package log contains utilities for fetching a new logger when one is not already available.
Package log contains utilities for fetching a new logger when one is not already available.
Index ¶
- Variables
- func SetLogger(l logr.Logger)
- func ZapLogger(development bool) logr.Logger
- func ZapLoggerTo(destWriter io.Writer, development bool) logr.Logger
- type DelegatingLogger
- type KubeAwareEncoder
- type NullLogger
- func (NullLogger) Enabled() bool
- func (NullLogger) Error(_ error, _ string, _ ...interface{})
- func (NullLogger) Info(_ string, _ ...interface{})
- func (log NullLogger) V(_ int) logr.InfoLogger
- func (log NullLogger) WithName(_ string) logr.Logger
- func (log NullLogger) WithValues(_ ...interface{}) logr.Logger
Constants ¶
This section is empty.
Variables ¶
var KBLog logr.Logger
KBLog is a base parent logger.
var Log = NewDelegatingLogger(NullLogger{})
Log is the base logger used by kubebuilder. It delegates to another logr.Logger. You *must* call SetLogger to get any actual logging.
Functions ¶
Types ¶
type DelegatingLogger ¶
DelegatingLogger is a logr.Logger that delegates to another logr.Logger. If the underlying promise is not nil, it registers calls to sub-loggers with the logging factory to be populated later, and returns a new delegating logger. It expects to have *some* logr.Logger set at all times (generally a no-op logger before the promises are fulfilled).
func NewDelegatingLogger ¶
func NewDelegatingLogger(initial logr.Logger) *DelegatingLogger
NewDelegatingLogger constructs a new DelegatingLogger which uses the given logger before it's promise is fulfilled.
func (*DelegatingLogger) Fulfill ¶
func (l *DelegatingLogger) Fulfill(actual logr.Logger)
Fulfill switches the logger over to use the actual logger provided, instead of the temporary initial one, if this method has not been previously called.
func (*DelegatingLogger) WithName ¶
func (l *DelegatingLogger) WithName(name string) logr.Logger
WithName provides a new Logger with the name appended
func (*DelegatingLogger) WithValues ¶
func (l *DelegatingLogger) WithValues(tags ...interface{}) logr.Logger
WithValues provides a new Logger with the tags appended
type KubeAwareEncoder ¶ added in v0.1.8
type KubeAwareEncoder struct { // Encoder is the zapcore.Encoder that this encoder delegates to zapcore.Encoder // Verbose controls whether or not the full object is printed. // If false, only name, namespace, api version, and kind are printed. // Otherwise, the full object is logged. Verbose bool }
KubeAwareEncoder is a Kubernetes-aware Zap Encoder. Instead of trying to force Kubernetes objects to implement ObjectMarshaller, we just implement a wrapper around a normal ObjectMarshaller that checks for Kubernetes objects.
func (*KubeAwareEncoder) Clone ¶ added in v0.1.8
func (k *KubeAwareEncoder) Clone() zapcore.Encoder
Clone implements zapcore.Encoder
func (*KubeAwareEncoder) EncodeEntry ¶ added in v0.1.8
func (k *KubeAwareEncoder) EncodeEntry(entry zapcore.Entry, fields []zapcore.Field) (*buffer.Buffer, error)
EncodeEntry implements zapcore.Encoder
type NullLogger ¶
type NullLogger struct{}
NullLogger is a logr.Logger that does nothing.
func (NullLogger) Error ¶
func (NullLogger) Error(_ error, _ string, _ ...interface{})
Error implements logr.Logger
func (NullLogger) Info ¶
func (NullLogger) Info(_ string, _ ...interface{})
Info implements logr.InfoLogger
func (NullLogger) WithName ¶
func (log NullLogger) WithName(_ string) logr.Logger
WithName implements logr.Logger
func (NullLogger) WithValues ¶
func (log NullLogger) WithValues(_ ...interface{}) logr.Logger
WithValues implements logr.Logger