It is not uncommon that users who are new to tracing look at the examples in the `master` branch of the repository and find that they don't compile. This is because they are examples which compile with the code from the master branch, which is for the as yet unreleased tracing 0.2.0 ecosystem. Users should instead go to the `v0.1.x` branch to find examples compatible with the crates published on crates.io. This change adds a doc-comment to the beginning of every example file informing the user of this fact and suggesting that they check out the `v0.1.x` branch instead.
24 lines
722 B
Rust
24 lines
722 B
Rust
//! NOTE: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem. For the
|
|
//! release examples, please see the `v0.1.x` branch instead.
|
|
#![deny(rust_2018_idioms)]
|
|
|
|
use tracing::{debug, span, Level};
|
|
use tracing_attributes::instrument;
|
|
|
|
#[instrument]
|
|
#[inline]
|
|
fn suggest_band() -> String {
|
|
debug!("Suggesting a band.");
|
|
String::from("Wild Pink")
|
|
}
|
|
|
|
fn main() {
|
|
let collector = tracing_subscriber::fmt()
|
|
.with_env_filter("attrs_literal_field_names=trace")
|
|
.finish();
|
|
tracing::collect::with_default(collector, || {
|
|
let span = span!(Level::TRACE, "get_band_rec", "guid:x-request-id" = "abcdef");
|
|
let _enter = span.enter();
|
|
suggest_band();
|
|
});
|
|
}
|