[][src]Crate tracing_attributes

A procedural macro attribute for instrumenting functions with tracing.

tracing is a framework for instrumenting Rust programs to collect structured, event-based diagnostic information. This crate provides the #[instrument] procedural macro attribute.

Note that this macro is also re-exported by the main tracing crate.

Usage

First, add this to your Cargo.toml:

[dependencies]
tracing-attributes = "0.1.9"

Compiler support: requires rustc 1.39+

The #[instrument] attribute can now be added to a function to automatically create and enter tracing span when that function is called. For example:

use tracing_attributes::instrument;

#[instrument]
pub fn my_function(my_arg: usize) {
    // ...
}

Attribute Macros

instrument

Instruments a function to create and enter a tracing span every time the function is called.