mirror of
https://github.com/tokio-rs/tracing.git
synced 2025-10-02 15:24:47 +00:00

## Motivation As discussed in #292: > A follow-up to remove an explicit dependency on `proc-macro2` would be > great, though, as it would make it easier to avoid pulling duplicate > versions of that crate. ## Solution Remove `proc-macro2` as a direct dependency and replace usages of types from it accordingly. - remove `proc-macro2` as a direct dependency - replace usage of `TokenStream` from `proc-macro2` with `impl ToTokens` from `quote` - remove usage of `Span::call_site` as that is used by default for the `quote!` macro
tracing-attributes
Macro attributes for application-level tracing.
Overview
tracing
is a framework for instrumenting Rust programs to collect
structured, event-based diagnostic information. This crate provides the
#[instrument]
attribute for automatically instrumenting functions using
tracing
.
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.0"
This crate provides the #[instrument]
attribute for instrumenting a function
with a tracing
span. For example:
use tracing_attributes::instrument;
#[instrument]
pub fn my_function(my_arg: usize) {
// ...
}
License
This project is licensed under the MIT license.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Tokio by you, shall be licensed as MIT, without any additional terms or conditions.