logging

package
v5.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EventTypeDontRecord will tell the logger not to emit a Kubernetes event for this log
	// line
	EventTypeDontRecord = "DontRecord"
)

Variables

This section is empty.

Functions

func WithEventRecorder

func WithEventRecorder(logger logr.LogSink, recorder record.EventRecorder, object runtime.Object) logr.Logger

func WithLabels

func WithLabels(logger logr.Logger, labels map[string]string, labelKeyPrefix string) logr.Logger

WithLabels decorates a logr.Logger so that any log entries contain all labels which keys are prefix by labelKeyPrefix

func WithNoRecord

func WithNoRecord(logger logr.Logger) logr.Logger

WithNoRecord adds a log key that suppresses the recorder

Types

type EventRecordingLogSink

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

func (*EventRecordingLogSink) Enabled

func (erl *EventRecordingLogSink) Enabled(level int) bool

Enabled tests whether this Logger is enabled. For example, commandline flags might be used to set the logging verbosity and disable some info logs. Enabled implements logr.LogSink.

func (*EventRecordingLogSink) Error

func (erl *EventRecordingLogSink) Error(err error, msg string, keysAndValues ...interface{})

Error logs an error, with the given message and key/value pairs as context. It functions similarly to calling Info with the "error" named value, but may have unique behavior, and should be preferred for logging errors (see the package documentations for more information).

The msg field should be used to add context to any underlying error, while the err field should be used to attach the actual error that triggered this log line, if present.

Error implements logr.LogSink.

func (*EventRecordingLogSink) Info

func (erl *EventRecordingLogSink) Info(levels int, msg string, keyvals ...interface{})

Info implements logr.LogSink.

func (*EventRecordingLogSink) Init

func (erl *EventRecordingLogSink) Init(info logr.RuntimeInfo)

Init implements logr.LogSink.

func (*EventRecordingLogSink) WithName

func (erl *EventRecordingLogSink) WithName(name string) logr.LogSink

WithName implements logr.LogSink.

func (*EventRecordingLogSink) WithValues

func (erl *EventRecordingLogSink) WithValues(values ...interface{}) logr.LogSink

WithValues implements logr.LogSink.

Jump to

Keyboard shortcuts

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