controller-runtime: sigs.k8s.io/controller-runtime/pkg/log Index | Files | Directories

package log

import "sigs.k8s.io/controller-runtime/pkg/log"

Package log contains utilities for fetching a new logger when one is not already available.

The Log Handle

This package contains a root logr.Logger Log. It may be used to get a handle to whatever the root logging implementation is. By default, no implementation exists, and the handle returns "promises" to loggers. When the implementation is set using SetLogger, these "promises" will be converted over to real loggers.

Logr

All logging in controller-runtime is structured, using a set of interfaces defined by a package called logr (https://godoc.org/github.com/go-logr/logr). The sub-package zap provides helpers for setting up logr backed by Zap (go.uber.org/zap).

Index

Package Files

deleg.go log.go null.go

Variables

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.

func SetLogger Uses

func SetLogger(l logr.Logger)

SetLogger sets a concrete logging implementation for all deferred Loggers.

type DelegatingLogger Uses

type DelegatingLogger struct {
    logr.Logger
    // contains filtered or unexported fields
}

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 Uses

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 Uses

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 Uses

func (l *DelegatingLogger) WithName(name string) logr.Logger

WithName provides a new Logger with the name appended

func (*DelegatingLogger) WithValues Uses

func (l *DelegatingLogger) WithValues(tags ...interface{}) logr.Logger

WithValues provides a new Logger with the tags appended

type NullLogger Uses

type NullLogger struct{}

NullLogger is a logr.Logger that does nothing.

func (NullLogger) Enabled Uses

func (NullLogger) Enabled() bool

Enabled implements logr.InfoLogger

func (NullLogger) Error Uses

func (NullLogger) Error(_ error, _ string, _ ...interface{})

Error implements logr.Logger

func (NullLogger) Info Uses

func (NullLogger) Info(_ string, _ ...interface{})

Info implements logr.InfoLogger

func (NullLogger) V Uses

func (log NullLogger) V(_ int) logr.InfoLogger

V implements logr.Logger

func (NullLogger) WithName Uses

func (log NullLogger) WithName(_ string) logr.Logger

WithName implements logr.Logger

func (NullLogger) WithValues Uses

func (log NullLogger) WithValues(_ ...interface{}) logr.Logger

WithValues implements logr.Logger

Directories

PathSynopsis
zapPackage zap contains helpers for setting up a new logr.Logger instance using the Zap logging framework.

Package log imports 2 packages (graph) and is imported by 25 packages. Updated 2019-09-12. Refresh now. Tools for package owners.