mirror of
https://github.com/tokio-rs/tracing.git
synced 2025-10-02 23:34:40 +00:00
21 lines
481 B
Rust
21 lines
481 B
Rust
//! Compare to the example given in the documentation for the `std::dbg` macro.
|
|
#![deny(rust_2018_idioms)]
|
|
|
|
use tracing_macros::dbg;
|
|
|
|
fn factorial(n: u32) -> u32 {
|
|
if dbg!(n <= 1) {
|
|
dbg!(1)
|
|
} else {
|
|
dbg!(n * factorial(n - 1))
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
env_logger::Builder::new().parse("trace").init();
|
|
#[allow(deprecated)]
|
|
let subscriber = tracing_log::TraceLogger::new();
|
|
|
|
tracing::subscriber::with_default(subscriber, || dbg!(factorial(4)));
|
|
}
|