Documentation ¶
Overview ¶
Package ctxlog extends ctxlog with events
Index ¶
- 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 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 EventLogger
Constants ¶
This section is empty.
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 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 EventLogger ¶ added in v0.2.0
type EventLogger interface { Infof(context.Context, string, ...interface{}) Errorf(context.Context, string, ...interface{}) error Error(context.Context, ...interface{}) error }
EventLogger adds events and writes logs
func WithEvent ¶ added in v0.2.0
func WithEvent(object runtime.Object, reason string) EventLogger
WithEvent returns a struct to provide event enhanced logging methods
Click to show internal directories.
Click to hide internal directories.