Documentation ¶
Overview ¶
Package logger defines an interface for adding a structured logger to a context and retrieving it again. The fallback when a context doesn't have a logger is the global klog logger.
This uses the same context key as logr and thus is compatible with code that uses that interface. The difference is that the Get function here never returns nil.
Also contains an extension of klog.KObj which includes the type of the object in the log output.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( KObj = klog.KObj KRef = klog.KRef )
Functions ¶
func CapacityRef ¶ added in v1.0.0
CapacityRef returns an object that pretty-prints the given number of bytes.
func Get ¶
Get returns the structured logger stored in the context or (if not set) a klog based logger.
Types ¶
type ObjectRefWithType ¶
type ObjectRefWithType struct { klog.ObjectRef Type string `json:"type,omitempty"` }
ObjectRef references a kubernetes object
func KObjWithType ¶
func KObjWithType(obj klog.KMetadata) ObjectRefWithType
KObj returns ObjectRefWithType from ObjectMeta
func (ObjectRefWithType) String ¶
func (ref ObjectRefWithType) String() string
Directories ¶
Path | Synopsis |
---|---|
Package testinglogger contains an implementation of the logr interface which is logging through a function like testing.TB.Log function.
|
Package testinglogger contains an implementation of the logr interface which is logging through a function like testing.TB.Log function. |