Created
December 15, 2023 01:37
-
-
Save bobisme/61d0a44734781563c922d2bb09451a54 to your computer and use it in GitHub Desktop.
common options for tracing subscriber logging to console
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn subscriber() -> impl tracing::subscriber::Subscriber { | |
use tracing_subscriber::{fmt::format::FmtSpan, prelude::*}; | |
tracing_subscriber::registry() | |
.with(tracing_subscriber::EnvFilter::from_default_env()) | |
.with( | |
tracing_subscriber::fmt::layer() | |
.compact() | |
.with_target(false) | |
.without_time() | |
.with_span_events(FmtSpan::CLOSE), | |
) | |
} | |
tracing::subscriber::set_global_default(subscriber()).unwrap(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment