Skip to content

Commit

Permalink
proc-macros: Make basic example more useful
Browse files Browse the repository at this point in the history
There was no event in `fn suggest_band`, so the span was entered but
nothing showed it doing so. A `debug!` line was added as well as
configuring the logger to log span entry and exits. This way, we see the
traced function has its own span.

Signed-off-by: Kevin Leimkuhler <kevinl@buoyant.io>
  • Loading branch information
kleimkuhler authored and hawkw committed Feb 8, 2019
1 parent 998ddde commit 2710728
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tokio-trace-proc-macros/examples/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ use tokio_trace::field;

fn main() {
env_logger::Builder::new().parse("trace").init();
let subscriber = tokio_trace_log::TraceLogger::new();
let subscriber = tokio_trace_log::TraceLogger::builder()
.with_span_entry(true)
.with_span_exits(true)
.finish();

tokio_trace::subscriber::with_default(subscriber, || {
let num: u64 = 1;
Expand All @@ -28,5 +31,6 @@ fn main() {
#[trace]
#[inline]
fn suggest_band() -> String {
debug!("Suggesting a band.");
format!("Wild Pink")
}

0 comments on commit 2710728

Please sign in to comment.