-
Notifications
You must be signed in to change notification settings - Fork 749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
subscriber: fix leading comma with Pretty
formatter
#1833
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
davidbarsky
approved these changes
Jan 13, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...whoops.
hawkw
added a commit
that referenced
this pull request
Jan 14, 2022
## Motivation 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. ## Solution This branch changes it back, and now the output looks nice again. :) ### Before ``` 2022-01-13T17:09:04.772411Z TRACE fmt_pretty::yak_shave: hello! I'm gonna shave a yak, excitement: "yay!" at examples/examples/fmt/yak_shave.rs:16 on main in fmt_pretty::yak_shave::shave with , yak: 2 in fmt_pretty::yak_shave::shaving_yaks with , yaks: 3 ``` ### After ``` 2022-01-13T17:10:28.472525Z TRACE fmt_pretty::yak_shave: hello! I'm gonna shave a yak, excitement: "yay!" at examples/examples/fmt/yak_shave.rs:16 on main in fmt_pretty::yak_shave::shave with yak: 1 in fmt_pretty::yak_shave::shaving_yaks with yaks: 3, ``` Fixes: #1832 [1]: 937c5d7#diff-a27a4c3564a0c2f1b7af32be0f9eec25ddfbe8b4c2be8d74e84d874b919b393bR227
hawkw
added a commit
that referenced
this pull request
Jan 14, 2022
## Motivation 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. ## Solution This branch changes it back, and now the output looks nice again. :) ### Before ``` 2022-01-13T17:09:04.772411Z TRACE fmt_pretty::yak_shave: hello! I'm gonna shave a yak, excitement: "yay!" at examples/examples/fmt/yak_shave.rs:16 on main in fmt_pretty::yak_shave::shave with , yak: 2 in fmt_pretty::yak_shave::shaving_yaks with , yaks: 3 ``` ### After ``` 2022-01-13T17:10:28.472525Z TRACE fmt_pretty::yak_shave: hello! I'm gonna shave a yak, excitement: "yay!" at examples/examples/fmt/yak_shave.rs:16 on main in fmt_pretty::yak_shave::shave with yak: 1 in fmt_pretty::yak_shave::shaving_yaks with yaks: 3, ``` Fixes: #1832 [1]: 937c5d7#diff-a27a4c3564a0c2f1b7af32be0f9eec25ddfbe8b4c2be8d74e84d874b919b393bR227
hawkw
added a commit
that referenced
this pull request
Jan 14, 2022
# 0.3.6 (Jan 14, 2022) This release adds configuration options to `tracing_subscriber::fmt` to log source code locations for events. ### Added - **fmt**: Added `with_file` and `with_line_number` configuration methods to `fmt::Format`, `fmt::SubscriberBuilder`, and `fmt::Layer` ([#1773]) ### Fixed - **fmt**: Removed incorrect leading comma from span fields with the `Pretty` formatter ([#1833]) ### Deprecated - **fmt**: Deprecated `Pretty::with_source_location`, as it can now be replaced by the more general `Format`, `SubscriberBuilder`, and `Layer` methods ([#1773]) Thanks to new contributor @renecouto for contributing to this release! [#1773]: #1773 [#1833]: #1833
hawkw
added a commit
that referenced
this pull request
Jan 14, 2022
# 0.3.6 (Jan 14, 2022) This release adds configuration options to `tracing_subscriber::fmt` to log source code locations for events. ### Added - **fmt**: Added `with_file` and `with_line_number` configuration methods to `fmt::Format`, `fmt::SubscriberBuilder`, and `fmt::Layer` ([#1773]) ### Fixed - **fmt**: Removed incorrect leading comma from span fields with the `Pretty` formatter ([#1833]) ### Deprecated - **fmt**: Deprecated `Pretty::with_source_location`, as it can now be replaced by the more general `Format`, `SubscriberBuilder`, and `Layer` methods ([#1773]) Thanks to new contributor @renecouto for contributing to this release! [#1773]: #1773 [#1833]: #1833
kaffarell
pushed a commit
to kaffarell/tracing
that referenced
this pull request
May 22, 2024
# 0.3.6 (Jan 14, 2022) This release adds configuration options to `tracing_subscriber::fmt` to log source code locations for events. ### Added - **fmt**: Added `with_file` and `with_line_number` configuration methods to `fmt::Format`, `fmt::SubscriberBuilder`, and `fmt::Layer` ([tokio-rs#1773]) ### Fixed - **fmt**: Removed incorrect leading comma from span fields with the `Pretty` formatter ([tokio-rs#1833]) ### Deprecated - **fmt**: Deprecated `Pretty::with_source_location`, as it can now be replaced by the more general `Format`, `SubscriberBuilder`, and `Layer` methods ([tokio-rs#1773]) Thanks to new contributor @renecouto for contributing to this release! [tokio-rs#1773]: tokio-rs#1773 [tokio-rs#1833]: tokio-rs#1833
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
PR #1661 introduced a regression with the
Pretty
formatter: thePrettyVisitor
type was accidentally changed from beingconstructed with
is_empty: true
to being constructed withis_empty: false
This means that when visiting a set of span fields,we emit a leading
,
before the first field, which looks quite bad.Solution
This branch changes it back, and now the output looks nice again. :)
Before
After
Fixes: #1832