Skip to content

Commit

Permalink
subscriber: fix leading comma with Pretty formatter
Browse files Browse the repository at this point in the history
PR #1661 introduced a regression with the `Pretty` formatter: the
`PrettyVisitor` type was [accidentally changed][1] from being
constructed with `is_empty: true` to being constructed with `is_empty:
false` This means that when visiting a set of span fields, we emit a
leading `, ` _before_ the first field, which looks quite bad.

This branch changes it back, and now the output looks nice again. :)

[1]: 937c5d7#diff-a27a4c3564a0c2f1b7af32be0f9eec25ddfbe8b4c2be8d74e84d874b919b393bR227
  • Loading branch information
hawkw committed Jan 13, 2022
1 parent feb3479 commit abb0a79
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tracing-subscriber/src/fmt/format/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ where

impl<'writer> FormatFields<'writer> for Pretty {
fn format_fields<R: RecordFields>(&self, writer: Writer<'writer>, fields: R) -> fmt::Result {
let mut v = PrettyVisitor::new(writer, false);
let mut v = PrettyVisitor::new(writer, true);
fields.record(&mut v);
v.finish()
}
Expand Down

0 comments on commit abb0a79

Please sign in to comment.