mirror of
https://github.com/tokio-rs/tracing.git
synced 2025-10-02 15:24:47 +00:00
![dependabot-preview[bot]](/assets/img/avatar_default.png)
* build(deps): update env_logger requirement from 0.5 to 0.7 Updates the requirements on [env_logger](https://github.com/sebasmagri/env_logger) to permit the latest version. - [Release notes](https://github.com/sebasmagri/env_logger/releases) - [Changelog](https://github.com/sebasmagri/env_logger/blob/master/CHANGELOG.md) - [Commits](https://github.com/sebasmagri/env_logger/commits/v0.7.1) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * fix compilation (#804) Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Sven <SirWindfield@users.noreply.github.com>
21 lines
489 B
Rust
21 lines
489 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_filters("trace").init();
|
|
#[allow(deprecated)]
|
|
let subscriber = tracing_log::TraceLogger::new();
|
|
|
|
tracing::subscriber::with_default(subscriber, || dbg!(factorial(4)));
|
|
}
|