Skip to content

Commit

Permalink
fix: remove key collision logging (#34)
Browse files Browse the repository at this point in the history
While this log message is nice to have, it's not worth having an
infinite loop over

Alternative solutions:
- Consider renaming colliding field

Fixes #33
  • Loading branch information
ctrlaltf24 committed Jul 16, 2023
1 parent c506eaf commit 5239429
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/formatting_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,26 +209,20 @@ impl<W: for<'a> MakeWriter<'a> + 'static> BunyanFormattingLayer<W> {

// Add all default fields
for (key, value) in self.default_fields.iter() {
// Make sure this key isn't reserved. If it is reserved,
// silently ignore
if !BUNYAN_REQUIRED_FIELDS.contains(&key.as_str()) {
self.serialize_field(&mut map_serializer, key, value)?;
} else {
tracing::debug!(
"{} is a reserved field in the bunyan log format. Skipping it.",
key
);
}
}

let extensions = span.extensions();
if let Some(visitor) = extensions.get::<JsonStorage>() {
for (key, value) in visitor.values() {
// Make sure this key isn't reserved. If it is reserved,
// silently ignore
if !BUNYAN_REQUIRED_FIELDS.contains(key) {
self.serialize_field(&mut map_serializer, key, value)?;
} else {
tracing::debug!(
"{} is a reserved field in the bunyan log format. Skipping it.",
key
);
}
}
}
Expand Down Expand Up @@ -361,13 +355,10 @@ where
let extensions = span.extensions();
if let Some(visitor) = extensions.get::<JsonStorage>() {
for (key, value) in visitor.values() {
// Make sure this key isn't reserved. If it is reserved,
// silently ignore
if !BUNYAN_REQUIRED_FIELDS.contains(key) {
self.serialize_field(&mut map_serializer, key, value)?;
} else {
tracing::debug!(
"{} is a reserved field in the bunyan log format. Skipping it.",
key
);
}
}
}
Expand Down

0 comments on commit 5239429

Please sign in to comment.