Macro init_tracing

Source
macro_rules! init_tracing {
    ($log_level:expr) => { ... };
}
Expand description

Convenience macro for initializing tracing with package name and version as fallbacks.

This macro calls init_tracing_with_fallbacks using the current package’s name and version from CARGO_PKG_NAME and CARGO_PKG_VERSION environment variables as fallback values.

§Arguments

  • log_level: The minimum log level for events (e.g., Level::INFO)

§Returns

A configured TracerProvider that should be kept alive for the duration of the application.

§Examples

use telemetry_rust::{init_tracing, shutdown_tracer_provider};
use tracing::Level;

let tracer_provider = init_tracing!(Level::INFO);

// Your application code here...

shutdown_tracer_provider(&tracer_provider);