-
Notifications
You must be signed in to change notification settings - Fork 666
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
Pretty formatter adds a bunch of commas at the end of output and does not display levels #1212
Comments
Yup, that definitely looks like a bug, I'll take a look!
Right now the |
It certainly wasn't clear to me that it does that. It's also isn't documented which color corresponds to what colors and it is impossible to use that in files as that would mess up the contents. It's best to give user the option decide what behavior they want but including the level as part of text output would be better than what we have right now. |
Sure, we can add them to the text output. For what it's worth, that formatter is intended primarily to be used in command-line tools and for local development, so supporting output without terminal colors (such as files) is not as high a priority there as for the other formatters. We could also make that a bit clearer in the documentation. |
It makes a lot more sense now. These points should definitely be mentioned in the docs. |
I went on a bit of a hunt and I think I figured out why there are a bunch of commas at the end. For the pretty formatter this record will end up as fields tracing/tracing-subscriber/src/fmt/format/pretty.rs Lines 285 to 303 in a0e1daa
where tracing/tracing-subscriber/src/fmt/format/pretty.rs Lines 293 to 295 in a0e1daa
where we don't actually write a value. So maybe_pad() in combination with log metadata will produce extra commas.
|
This fixes tokio-rs#1212 where extra padding was written when logging with metadata. With this change we only write padding when we actually decide to write a value, not when skipping a metadata value.
## Motivation This fixes #1212, where extra padding was written when logging with the pretty formatter. ## Solution With this change we only write padding when we actually decide to write a value but not when skipping a metadata value such as `log.file` or `log.line`
## Motivation This fixes #1212, where extra padding was written when logging with the pretty formatter. ## Solution With this change we only write padding when we actually decide to write a value but not when skipping a metadata value such as `log.file` or `log.line`
## Motivation This fixes #1212, where extra padding was written when logging with the pretty formatter. ## Solution With this change we only write padding when we actually decide to write a value but not when skipping a metadata value such as `log.file` or `log.line`
Bug Report
Version
Platform
Description
Pretty formatter adds a bunch of commas at the end of output (only for logs outputed by
log
) and does not display levels.Code:
Output:
Notice how there the
sqlx
log has a bunch of commas at the end of the line.sqlx
uses thelog
crate so this bug is present on the first log but not the other which is logged as (in mymain.rs
)Also, notice how there are no levels when there should be.
None of these errors are present when using the regular formatter (after removing the
.pretty()
line from config)The text was updated successfully, but these errors were encountered: