Module macros

Module macros 

Expand description

Macros for structured logging and telemetry.

This module provides convenient macros for creating spans, adding events, and logging messages with various severity levels. The macros provide a more ergonomic interface compared to the lower-level functions and handle attribute creation automatically.

§Span Creation

  • span!: Creates a new span with optional attributes
  • event!: Adds an event to the current span

§Logging Macros

  • log!: Generic logging macro that accepts a severity level
  • trace!: Logs trace-level messages (most verbose)
  • debug!: Logs debug-level messages
  • info!: Logs informational messages
  • warn!: Logs warning messages
  • error!: Logs error messages
  • fatal!: Logs fatal error messages

§Attribute Handling

  • attributes!: Creates a slice of key-value attributes
  • attribute!: Creates a single key-value attribute

All macros support flexible attribute syntax for adding contextual information.

Macros§

attributes
Constructs a slice of KeyValue attributes.