Eliza Weisman 3081a19812
chore: update nursery crates to use path deps on tracing (#101)
This branch updates the "nursery" crates to depend on `tracing` and
`tracing-core` as path dependencies, rather than depending on the
crates.io releases of `tokio-trace` and `tokio-trace-core`. When
`tracing` and `tracing-core` are released, we will change these from
path dependencies to crates.io dependencies.

This branch also updates those crates to track API changes in `tracing`
and `tracing-core`.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2019-06-26 16:42:10 -07:00

36 lines
831 B
Rust

#[macro_use]
extern crate tracing;
#[macro_use]
extern crate tracing_proc_macros;
extern crate env_logger;
extern crate tracing_fmt;
use tracing::{field, Level};
fn main() {
env_logger::Builder::new().parse("trace").init();
let subscriber = tracing_fmt::FmtSubscriber::builder().finish();
tracing::subscriber::with_default(subscriber, || {
let num: u64 = 1;
let span = span!(
Level::TRACE,
"Getting rec from another function.",
number_of_recs = &num
);
let _enter = span.enter();
let band = suggest_band();
info!(
{ band_recommendation = field::display(&band) },
"Got a rec."
);
});
}
#[trace]
#[inline]
fn suggest_band() -> String {
debug!("Suggesting a band.");
format!("Wild Pink")
}