mirror of
https://github.com/tokio-rs/tracing.git
synced 2025-10-02 07:20:35 +00:00

## Motivation Currently, `tracing-futures` and `tracing-attributes` both have separate crates for tests that require `std::future` and async/await syntax. These date back to before these features were stable, and the tests were separated because they could only be run on nighly Rust. This has not been the case for a long while, and `tracing` now supports `std::future` as the default, requiring opt-in support for `futures` 0.1. I think we had forgotten to remove the special-cased tests when we made that transition. ## Solution This branch removes the special-cased test crates, and moves all `std::future` and async/await tests into the main test dirs for these crates. I've also removed the separate CI steps that ran these. This should simplify things significantly! Signed-off-by: Eliza Weisman <eliza@buoyant.io>
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.7"
Compiler support: requires rustc 1.39+
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.