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 Debugf ¶
Debugf uses the stored zap logger
func Errorf ¶
Errorf uses the stored zap logger
func ExtractLogger ¶
func ExtractLogger(ctx context.Context) *zap.SugaredLogger
ExtractLogger returns the logger from the context
func ExtractLoggerWithOptions ¶ added in v0.4.0
ExtractLoggerWithOptions returns a logger with different options than the parent
func ExtractRecorder ¶ added in v0.2.0
func ExtractRecorder(ctx context.Context) record.EventRecorder
ExtractRecorder returns the event recorder from the context
func Infof ¶
Infof uses the stored zap logger
func NewContextWithRecorder ¶ added in v0.2.0
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 ¶ added in v0.2.0
func NewParentContext(log *zap.SugaredLogger) context.Context
NewParentContext returns a new context with a logger
Types ¶
type Event ¶ added in v0.3.1
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 ¶ added in v0.2.0
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.
func (Event) Debugf ¶ added in v0.3.1
Debugf logs and adds an info event
func (Event) Error ¶ added in v0.3.1
Error uses the stored zap logger and recorder
func (Event) Errorf ¶ added in v0.3.1
Errorf uses the stored zap logger and the recorder to log an error, it returns an error like fmt.Errorf
type MappingEvent ¶ added in v0.3.1
type MappingEvent struct {
Event
}
MappingEvent is used to debug EnqueueRequestsFromMapFunc in controllers
func NewMappingEvent ¶ added in v0.3.1
func NewMappingEvent(object runtime.Object) MappingEvent
NewMappingEvent returns a log event with the 'mapping' reason
type PredicateEvent ¶ added in v0.3.1
type PredicateEvent struct {
Event
}
PredicateEvent is used to debug controller predicates
func NewPredicateEvent ¶ added in v0.3.1
func NewPredicateEvent(object runtime.Object) PredicateEvent
NewPredicateEvent returns a log event with the 'predicate' reason
type ReconcileEventsFromSource ¶ added in v0.3.0
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
Source Files
¶
- context.go
- events.go
- logging.go