]> git.proxmox.com Git - rustc.git/blame - vendor/tracing-attributes/README.md
New upstream version 1.66.0+dfsg1
[rustc.git] / vendor / tracing-attributes / README.md
CommitLineData
3dfed10e
XL
1![Tracing — Structured, application-level diagnostics][splash]
2
3[splash]: https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/splash.svg
4
f035d41b
XL
5# tracing-attributes
6
7Macro attributes for application-level tracing.
8
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]
15
16[Documentation][docs-url] | [Chat][discord-url]
17
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
2b03887a 21[docs-url]: https://docs.rs/tracing-attributes/0.1.23
f035d41b
XL
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
25[mit-url]: LICENSE
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
30
31## Overview
32
33[`tracing`] is a framework for instrumenting Rust programs to collect
34structured, event-based diagnostic information. This crate provides the
35`#[instrument]` attribute for automatically instrumenting functions using
36`tracing`.
37
38Note that this macro is also re-exported by the main `tracing` crate.
39
5e7ed085 40*Compiler support: [requires `rustc` 1.49+][msrv]*
3dfed10e
XL
41
42[msrv]: #supported-rust-versions
43
f035d41b
XL
44## Usage
45
46First, add this to your `Cargo.toml`:
47
48```toml
49[dependencies]
2b03887a 50tracing-attributes = "0.1.23"
f035d41b
XL
51```
52
f035d41b
XL
53
54This crate provides the `#[instrument]` attribute for instrumenting a function
55with a `tracing` [span]. For example:
56
57```rust
58use tracing_attributes::instrument;
59
60#[instrument]
61pub fn my_function(my_arg: usize) {
62 // ...
63}
64```
65
f035d41b 66[`tracing`]: https://crates.io/crates/tracing
3dfed10e
XL
67[span]: https://docs.rs/tracing/latest/tracing/span/index.html
68
69## Supported Rust Versions
70
71Tracing is built against the latest stable release. The minimum supported
5e7ed085 72version is 1.49. The current Tracing version is not guaranteed to build on Rust
3dfed10e
XL
73versions earlier than the minimum supported version.
74
75Tracing follows the same compiler support policies as the rest of the Tokio
76project. The current stable Rust compiler and the three most recent minor
77versions before it will always be supported. For example, if the current stable
78compiler version is 1.45, the minimum supported version will not be increased
79past 1.42, three minor versions prior. Increasing the minimum supported compiler
80version is not considered a semver breaking change as long as doing so complies
81with this policy.
f035d41b
XL
82
83## License
84
85This project is licensed under the [MIT license](LICENSE).
86
87### Contribution
88
89Unless you explicitly state otherwise, any contribution intentionally submitted
90for inclusion in Tokio by you, shall be licensed as MIT, without any additional
91terms or conditions.