Skip to content

Commit

Permalink
Modify values when a record event is found (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
teromene authored Mar 24, 2022
1 parent 3d5ca32 commit bedb9b3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,23 @@ where
self.enter_span(ctx.span(id).expect("Span not found."), ts);
}

fn on_record(&self, id: &span::Id, values: &span::Record<'_>, ctx: Context<'_, S>) {
if self.include_args {
let span = ctx.span(id).unwrap();
let mut exts = span
.extensions_mut();

let args = exts
.get_mut::<ArgsWrapper>();

if let Some(args) = args {
let args = Arc::make_mut(&mut args.args);
values.record(&mut JsonVisitor { object: args });
}

}
}

fn on_event(&self, event: &Event<'_>, _ctx: Context<'_, S>) {
let ts = self.get_ts();
let callsite = self.get_callsite(EventOrSpan::Event(event));
Expand Down

0 comments on commit bedb9b3

Please sign in to comment.