Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package ctxlog extends ctxlog with events
Index ¶
- Constants
 - func Debug(ctx context.Context, v ...interface{})
 - func Debugf(ctx context.Context, format string, v ...interface{})
 - func Error(ctx context.Context, v ...interface{})
 - func Errorf(ctx context.Context, format string, v ...interface{})
 - func ExtractLogger(ctx context.Context) *zap.SugaredLogger
 - func ExtractLoggerWithOptions(ctx context.Context, options ...zap.Option) *zap.SugaredLogger
 - func ExtractRecorder(ctx context.Context) record.EventRecorder
 - func Info(ctx context.Context, v ...interface{})
 - func Infof(ctx context.Context, format string, v ...interface{})
 - func NewContextWithRecorder(ctx context.Context, name string, recorder record.EventRecorder) context.Context
 - func NewParentContext(log *zap.SugaredLogger) context.Context
 - func WarningEvent(ctx context.Context, object runtime.Object, reason, msg string)
 - type Event
 - func (ev Event) Debugf(ctx context.Context, format string, v ...interface{})
 - func (ev Event) Error(ctx context.Context, parts ...interface{}) error
 - func (ev Event) Errorf(ctx context.Context, format string, v ...interface{}) error
 - func (ev Event) Infof(ctx context.Context, format string, v ...interface{})
 
- type MappingEvent
 - type PredicateEvent
 - type ReconcileEventsFromSource
 
Constants ¶
const ( // ReasonPredicates is used for controller predicate related logging ReasonPredicates = "Predicates" // ReasonMapping is used for controller EnqueueRequestsFromMapFunc related logging ReasonMapping = "Mapping" )
Variables ¶
This section is empty.
Functions ¶
func ExtractLogger ¶
func ExtractLogger(ctx context.Context) *zap.SugaredLogger
ExtractLogger returns the logger from the context
func ExtractLoggerWithOptions ¶
ExtractLoggerWithOptions returns a logger with different options than the parent
func ExtractRecorder ¶
func ExtractRecorder(ctx context.Context) record.EventRecorder
ExtractRecorder returns the event recorder from the context
func NewContextWithRecorder ¶
func NewContextWithRecorder(ctx context.Context, name string, recorder record.EventRecorder) context.Context
NewContextWithRecorder returns a new child context with the named recorder and log inside
func NewParentContext ¶
func NewParentContext(log *zap.SugaredLogger) context.Context
NewParentContext returns a new context with a logger
Types ¶
type Event ¶
type Event struct {
	// contains filtered or unexported fields
}
    Event holds information about a k8s events we create via controller-runtime's event recorder
func WithEvent ¶
WithEvent returns a struct to provide event enhanced logging methods 'object' is the object this event is about. Event will make a reference-- or you may also pass a reference to the object directly. 'reason' is the reason this event is generated. 'reason' should be short and unique; it should be in UpperCamelCase format (starting with a capital letter). "reason" will be used to automate handling of events, so imagine people writing switch statements to handle them. You want to make that easy.
type MappingEvent ¶
type MappingEvent struct {
	Event
}
    MappingEvent is used to debug EnqueueRequestsFromMapFunc in controllers
func NewMappingEvent ¶
func NewMappingEvent(object runtime.Object) MappingEvent
NewMappingEvent returns a log event with the 'mapping' reason
type PredicateEvent ¶
type PredicateEvent struct {
	Event
}
    PredicateEvent is used to debug controller predicates
func NewPredicateEvent ¶
func NewPredicateEvent(object runtime.Object) PredicateEvent
NewPredicateEvent returns a log event with the 'predicate' reason
type ReconcileEventsFromSource ¶
type ReconcileEventsFromSource struct {
	ReconciliationObjectName string `json:"reconciliationObjectName"`
	ReconciliationObjectKind string `json:"reconciliationObjectKind"`
	PredicateObjectName      string `json:"predicateObjectName"`
	PredicateObjectKind      string `json:"predicateObjectKind"`
	Namespace                string `json:"namespace"`
	Message                  string `json:"message"`
	Type                     string `json:"type"`
}
    ReconcileEventsFromSource for defining useful logs when defining a mapping between a watched object and a reconcile one