zap

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2025 License: MIT Imports: 4 Imported by: 0

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

func Format(ctx context.Context) zapcore.Field

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL