Documentation
¶
Overview ¶
Package zap provides integration between distributed tracing and structured logging. It enables automatic inclusion of trace context (trace IDs and span IDs) in log entries, facilitating correlation between traces and logs in observability platforms.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Format ¶
Format extracts trace and span IDs from a context and returns them as a zap field for structured logging. If no active span is found in the context, it returns a Skip field. This function allows easy inclusion of trace context in log entries.
Example usage:
logger.Info("Processing request", tracing.Format(ctx), zap.String("user_id", userID))
Parameters:
- ctx: The context containing the trace information
Returns:
- zapcore.Field: A zap field containing the trace and span IDs, or a Skip field if no span is present
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.