Documentation
¶
Overview ¶
Package logging provides structured logging utilities for KubeVela webhooks with focus on request traceability and observability.
Index ¶
- Constants
- func RequestIDFrom(ctx context.Context) (string, bool)
- func WithRequestID(ctx context.Context, requestID string) context.Context
- type Logger
- func (l Logger) Debug(msg string, keysAndValues ...interface{})
- func (l Logger) Error(err error, msg string, keysAndValues ...interface{})
- func (l Logger) Info(msg string, keysAndValues ...interface{})
- func (l Logger) IntoContext(ctx context.Context) context.Context
- func (l Logger) Trace(msg string, keysAndValues ...interface{})
- func (l Logger) V(level int) Logger
- func (l Logger) WithError(err error) Logger
- func (l Logger) WithStep(step string) Logger
- func (l Logger) WithSuccess(success bool, startTime ...time.Time) Logger
- func (l Logger) WithValues(keysAndValues ...interface{}) Logger
Constants ¶
View Source
const ( // Core traceability fields FieldRequestID = "requestID" // Unique identifier for request correlation FieldOperation = "operation" // Webhook operation (CREATE/UPDATE/DELETE) FieldHandler = "handler" // Handler processing the request FieldStep = "step" // Current processing step FieldDuration = "durationMs" // Operation duration in milliseconds // Resource identification FieldName = "name" // Resource name FieldNamespace = "namespace" // Resource namespace FieldKind = "kind" // Resource kind FieldGeneration = "generation" // Resource generation // User context FieldUserName = "user" // User making the request // Error tracking FieldError = "error" // Error indicator FieldSuccess = "success" // Success indicator )
Structured logging field keys - consistent across all handlers for observability
Variables ¶
This section is empty.
Functions ¶
func RequestIDFrom ¶
RequestIDFrom retrieves request ID from context
Types ¶
type Logger ¶
Logger wraps logr.Logger with structured logging methods
func NewHandlerLogger ¶
NewHandlerLogger creates a logger for webhook handlers with full request context
func WithContext ¶
WithContext returns a Logger from context or creates a new one
func (Logger) IntoContext ¶
IntoContext stores the Logger in context
func (Logger) WithSuccess ¶
WithSuccess adds success and duration fields to the logger
func (Logger) WithValues ¶
WithValues adds key-value pairs to the logger
Click to show internal directories.
Click to hide internal directories.