1 ![Tracing — Structured, application-level diagnostics][splash]
3 [splash]: https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/splash.svg
7 Macro attributes for application-level tracing.
9 [![Crates.io][crates-badge]][crates-url]
10 [![Documentation][docs-badge]][docs-url]
11 [![Documentation (master)][docs-master-badge]][docs-master-url]
12 [![MIT licensed][mit-badge]][mit-url]
13 [![Build Status][actions-badge]][actions-url]
14 [![Discord chat][discord-badge]][discord-url]
16 [Documentation][docs-url] | [Chat][discord-url]
18 [crates-badge]: https://img.shields.io/crates/v/tracing-attributes.svg
19 [crates-url]: https://crates.io/crates/tracing-attributes
20 [docs-badge]: https://docs.rs/tracing-attributes/badge.svg
21 [docs-url]: https://docs.rs/tracing-attributes/0.1.23
22 [docs-master-badge]: https://img.shields.io/badge/docs-master-blue
23 [docs-master-url]: https://tracing-rs.netlify.com/tracing_attributes
24 [mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg
26 [actions-badge]: https://github.com/tokio-rs/tracing/workflows/CI/badge.svg
27 [actions-url]:https://github.com/tokio-rs/tracing/actions?query=workflow%3ACI
28 [discord-badge]: https://img.shields.io/discord/500028886025895936?logo=discord&label=discord&logoColor=white
29 [discord-url]: https://discord.gg/EeF3cQw
33 [`tracing`] is a framework for instrumenting Rust programs to collect
34 structured, event-based diagnostic information. This crate provides the
35 `#[instrument]` attribute for automatically instrumenting functions using
38 Note that this macro is also re-exported by the main `tracing` crate.
40 *Compiler support: [requires `rustc` 1.56+][msrv]*
42 [msrv]: #supported-rust-versions
46 First, add this to your `Cargo.toml`:
50 tracing-attributes = "0.1.23"
54 This crate provides the `#[instrument]` attribute for instrumenting a function
55 with a `tracing` [span]. For example:
58 use tracing_attributes::instrument;
61 pub fn my_function(my_arg: usize) {
66 [`tracing`]: https://crates.io/crates/tracing
67 [span]: https://docs.rs/tracing/latest/tracing/span/index.html
69 ## Supported Rust Versions
71 Tracing is built against the latest stable release. The minimum supported
72 version is 1.56. The current Tracing version is not guaranteed to build on Rust
73 versions earlier than the minimum supported version.
75 Tracing follows the same compiler support policies as the rest of the Tokio
76 project. The current stable Rust compiler and the three most recent minor
77 versions before it will always be supported. For example, if the current stable
78 compiler version is 1.69, the minimum supported version will not be increased
79 past 1.66, three minor versions prior. Increasing the minimum supported compiler
80 version is not considered a semver breaking change as long as doing so complies
85 This project is licensed under the [MIT license](LICENSE).
89 Unless you explicitly state otherwise, any contribution intentionally submitted
90 for inclusion in Tokio by you, shall be licensed as MIT, without any additional