Skip to content
This repository has been archived by the owner on Jun 8, 2024. It is now read-only.

Commit

Permalink
remove redundant timestamps from tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
KodrAus committed Mar 14, 2024
1 parent 1c1fcea commit b186371
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions targets/tracing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ impl<S: tracing::Subscriber> emit::Emitter for TracingEmitter<S> {
None,
tracing::field::FieldSet::new(
&[
emit::well_known::TS_KEY,
emit::well_known::TS_START_KEY,
emit::well_known::MSG_KEY,
emit::well_known::TPL_KEY,
"props",
Expand All @@ -142,28 +140,13 @@ impl<S: tracing::Subscriber> emit::Emitter for TracingEmitter<S> {

let fields = tracing::field::FieldSet::new(
&[
emit::well_known::TS_KEY,
emit::well_known::TS_START_KEY,
emit::well_known::MSG_KEY,
emit::well_known::TPL_KEY,
"props",
],
tracing_core::identify_callsite!(&CALLSITE),
);

let mut ts = None;
let mut ts_start = None;

if let Some(extent) = evt.extent() {
let range = extent.as_range();

ts = Some(tracing::field::display(range.end));

if extent.is_span() {
ts_start = Some(tracing::field::display(range.start));
}
}

let msg = tracing::field::display(evt.msg());
let tpl = tracing::field::display(evt.tpl());
let props = tracing::field::debug(DebugProps(evt.props().filter(|k, _| {
Expand All @@ -173,16 +156,6 @@ impl<S: tracing::Subscriber> emit::Emitter for TracingEmitter<S> {
self.0.event(&tracing::Event::new(
&METADATA,
&fields.value_set(&[
(
&fields.field(emit::well_known::TS_KEY).unwrap(),
ts.as_ref().map(|ts| ts as &dyn tracing::Value),
),
(
&fields.field(emit::well_known::TS_START_KEY).unwrap(),
ts_start
.as_ref()
.map(|ts_start| ts_start as &dyn tracing::Value),
),
(
&fields.field(emit::well_known::MSG_KEY).unwrap(),
Some(&msg as &dyn tracing::Value),
Expand Down

0 comments on commit b186371

Please sign in to comment.