Skip to content

Commit

Permalink
sc-tracing: Only print events for whitelisted targets (paritytech#14487)
Browse files Browse the repository at this point in the history
* sc-tracing: Only print events for whitelisted targets

We should only print events for whitelisted targets, otherwise we may run into some stack overflow
while printing the event.

* Update client/tracing/src/lib.rs

Co-authored-by: Koute <koute@users.noreply.github.com>

* Fix

---------

Co-authored-by: Koute <koute@users.noreply.github.com>
  • Loading branch information
2 people authored and nathanwhit committed Jul 19, 2023
1 parent 271e557 commit 7ae2120
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/tracing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ where
}

fn on_event(&self, event: &Event<'_>, ctx: Context<S>) {
if !self.check_target(event.metadata().target(), &event.metadata().level()) {
return
}

let parent_id = event.parent().cloned().or_else(|| {
if event.is_contextual() {
ctx.lookup_current().map(|span| span.id())
Expand Down

0 comments on commit 7ae2120

Please sign in to comment.