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.
25 lines
968 B
Rust
25 lines
968 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.
|
|
use tracing::Level;
|
|
|
|
#[no_mangle]
|
|
#[inline(never)]
|
|
pub fn event() {
|
|
tracing::info!("general informational messages relevant to users");
|
|
}
|
|
|
|
fn main() {
|
|
tracing_subscriber::fmt()
|
|
// all spans/events with a level higher than TRACE (e.g, info, warn, etc.)
|
|
// will be written to stdout.
|
|
.with_max_level(Level::TRACE)
|
|
// sets this to be the default, global collector for this application.
|
|
.init();
|
|
event();
|
|
|
|
tracing::error!("SOMETHING IS SERIOUSLY WRONG!!!");
|
|
tracing::warn!("important informational messages; might indicate an error");
|
|
tracing::info!("general informational messages relevant to users");
|
|
tracing::debug!("diagnostics used for internal debugging of a library or application");
|
|
tracing::trace!("very verbose diagnostic events");
|
|
}
|