-
Notifications
You must be signed in to change notification settings - Fork 764
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
tracing: don't require delimiters for format_args #288
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
Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
LucioFranco
approved these changes
Aug 17, 2019
Signed-off-by: Eliza Weisman <[email protected]>
yaahc
approved these changes
Aug 19, 2019
hawkw
added a commit
that referenced
this pull request
Aug 20, 2019
Added: - `std::error::Error` as a new primitive type (#277) - Support for mixing key-value fields and `format_args` messages without curly braces as delimiters (#288) Changed: - `tracing-core` dependency to 0.1.5 (#294) - `tracing-attributes` dependency to 0.1.2 Signed-off-by: Eliza Weisman <[email protected]>
hawkw
added a commit
that referenced
this pull request
Aug 20, 2019
Added: - `std::error::Error` as a new primitive type (#277) - Support for mixing key-value fields and `format_args` messages without curly braces as delimiters (#288) Changed: - `tracing-core` dependency to 0.1.5 (#294) - `tracing-attributes` dependency to 0.1.2 Signed-off-by: Eliza Weisman <[email protected]>
hawkw
added a commit
that referenced
this pull request
Aug 20, 2019
Added: - `std::error::Error` as a new primitive type (#277) - Support for mixing key-value fields and `format_args` messages without curly braces as delimiters (#288) Changed: - `tracing-core` dependency to 0.1.5 (#294) - `tracing-attributes` dependency to 0.1.2 Signed-off-by: Eliza Weisman <[email protected]>
hawkw
added a commit
that referenced
this pull request
Aug 30, 2019
#288 introduced a regression that causes infinite macro recursion when the `log` feature is enabled. This PR fixes it (by making the macros significantly worse). I've also added a new test step that runs with `--all-features`, since apparently CI doesn't already do this. Additionally, I've simplified some of the macros a bit: it turns out we don't have to have as many match arms if we make the macros slightly more lenient about where commas can show up. Fixes #303 Signed-off-by: Eliza Weisman <[email protected]>
hawkw
added a commit
that referenced
this pull request
Aug 30, 2019
## Motivation The old syntax for macros with messages would put the message field first, followed by all the other fields. The new (no curly braces) syntax (added in #288) puts messages last, inconsistently with everything else. Since message field ordering currently matters for how some subscribers (e.g. `tracing-fmt`) display events, we should make this somewhat more consistent. ## Solution This branch changes the new macro syntax to put the `message` field first, rather than last. Signed-off-by: Eliza Weisman <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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
Currently, the
tracing
macros require curly braces as delimiters whena
format_args
macro is used in addition to structured fields, like:This is confusing, since the delimiters are not used in other cases; it
makes the syntax more complex; and, most importantly, I think it looks
kind of ugly.
I've been planning to get rid of this when we transition to procedural
macros, but the transition is currently blocked on a compiler bug,
rust-lang/rust#62325.
(see #133 (comment))
I've been getting tired of waiting for this.
Solution:
This branch updates the
tracing
crate's macros to support aformat_args message after the structured key-value fields without curly
braces. For example,
I've updated the tests & examples in the
tracing
crate so that theyshow this usage rather than the old usage.
The old form with curly braces is still supported, since removing it
would be a breaking change, but we'll transition it out in examples &
tutorials. (can you put a
deprecated
attribute on a specific macroarm???).
Signed-off-by: Eliza Weisman [email protected]