Skip to content

Commit

Permalink
Go back to the custom tracing subscriber, adding a filter for spammy …
Browse files Browse the repository at this point in the history
…dependencies. #11
  • Loading branch information
dabreegster committed Mar 1, 2022
1 parent 1e76c6f commit 7b21cd1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 1 addition & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ const DEFAULT_CASES_PER_MSOA: usize = 5;

#[tokio::main]
async fn main() -> Result<()> {
let subscriber = tracing_subscriber::FmtSubscriber::builder()
.with_max_level(tracing::Level::DEBUG)
.finish();
tracing::subscriber::set_global_default(subscriber).expect("setting default subscriber failed");
//ramp::tracing_span_tree::SpanTree::new().enable();
ramp::tracing_span_tree::SpanTree::new().enable();

let args = Args::parse();

Expand Down
6 changes: 5 additions & 1 deletion src/tracing_span_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ impl SpanTree {

/// Set as a global subscriber
pub fn enable(self) {
let subscriber = Registry::default().with(self);
// Ignore everything except our own code. hyper and reqwest are very spammy.
// TODO Filter more carefully -- anything >= INFO from other crates is probably fine
let subscriber = Registry::default().with(self.with_filter(
tracing_subscriber::filter::filter_fn(|metadata| metadata.target().starts_with("ramp")),
));
tracing::subscriber::set_global_default(subscriber)
.unwrap_or_else(|_| debug!("Global subscriber is already set"));
}
Expand Down

0 comments on commit 7b21cd1

Please sign in to comment.