Skip to content

Commit 6aae1cc

Browse files
authored
tracing: new syntax puts messages first (#309)
## 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]>
1 parent 90dbae6 commit 6aae1cc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tracing/src/macros.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2222,7 +2222,7 @@ macro_rules! valueset {
22222222
};
22232223
// Remainder is unparseable, but exists --- must be format args!
22242224
(@ { $(,)* $($out:expr),* }, $next:expr, $($rest:tt)+) => {
2225-
$crate::valueset!(@ { $($out),*, (&$next, Some(&format_args!($($rest)+) as &Value)) }, $next, )
2225+
$crate::valueset!(@ { (&$next, Some(&format_args!($($rest)+) as &Value)), $($out),* }, $next, )
22262226
};
22272227

22282228
// === entry ===
@@ -2280,7 +2280,7 @@ macro_rules! fieldset {
22802280

22812281
// Remainder is unparseable, but exists --- must be format args!
22822282
(@ { $(,)* $($out:expr),* } $($rest:tt)+) => {
2283-
$crate::fieldset!(@ { $($out),*, "message" })
2283+
$crate::fieldset!(@ { "message", $($out),*, })
22842284
};
22852285

22862286
// == entry ==

0 commit comments

Comments
 (0)