debug

package
v0.0.0-...-8ffad75 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultObjectValue

func DefaultObjectValue(obj client.Object) any

DefaultObjectValue provides object logging values by using klog.KObj.

func Handler

func Handler(name string, handler handler.EventHandler, opts ...HandlerOption) handler.EventHandler

Handler allows debugging a handler.EventHandler by wrapping it and logging each action it does.

Caution: This has a heavy toll on runtime performance and should *not* be used in production code. Use only for debugging handlers and remove once done.

func Predicate

func Predicate(name string, prct predicate.Predicate, opts ...PredicateOption) predicate.Predicate

Predicate allows debugging a predicate.Predicate by wrapping it and logging each action it does.

Caution: This has a heavy toll on runtime performance and should *not* be used in production code. Use only for debugging predicates and remove once done.

Types

type HandlerOption

type HandlerOption interface {
	ApplyToHandler(o *HandlerOptions)
}

type HandlerOptions

type HandlerOptions struct {
	// Log is the logger to use. If unspecified, the debug package logger will be used.
	Log logr.Logger

	// ObjectValue controls how an object will be represented as in the log values.
	ObjectValue func(client.Object) any
}

HandlerOptions are options for construction a debug handler.

func (*HandlerOptions) ApplyOptions

func (o *HandlerOptions) ApplyOptions(opts []HandlerOption) *HandlerOptions

type PredicateOption

type PredicateOption interface {
	ApplyToPredicate(o *PredicateOptions)
}

type PredicateOptions

type PredicateOptions struct {
	// Log is the logger to use. If unspecified, the debug package logger will be used.
	Log logr.Logger

	// ObjectValue controls how an object will be represented as in the log values.
	ObjectValue func(client.Object) any
}

PredicateOptions are options for construction a debug predicate.

func (*PredicateOptions) ApplyOptions

func (o *PredicateOptions) ApplyOptions(opts []PredicateOption) *PredicateOptions

func (*PredicateOptions) ApplyToPredicate

func (o *PredicateOptions) ApplyToPredicate(o2 *PredicateOptions)

type WithLog

type WithLog struct {
	Log logr.Logger
}

WithLog specifies the logger to use.

func (WithLog) ApplyToHandler

func (w WithLog) ApplyToHandler(o *HandlerOptions)

func (WithLog) ApplyToPredicate

func (w WithLog) ApplyToPredicate(o *PredicateOptions)

type WithObjectValue

type WithObjectValue func(obj client.Object) any

WithObjectValue specifies the function to log an client.Object's value with.

func (WithObjectValue) ApplyToHandler

func (w WithObjectValue) ApplyToHandler(o *HandlerOptions)

func (WithObjectValue) ApplyToPredicate

func (w WithObjectValue) ApplyToPredicate(o *PredicateOptions)

Jump to

Keyboard shortcuts

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