From 5cb8922d51a4b365d4bee89184359920e21cc3ae Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Wed, 14 Feb 2024 12:42:56 +0100 Subject: [PATCH] macros: Fix non-simple macro usage without message If something like `warn!(?foo)` and `warn!(name: "foo", ?foo)` works, then `warn!(name: "foo", target: "foo_events", ?foo)` should arguably also work. Before this change the more complicated variants of the macros however required a message argument, due to the usage of the `+` specifier in the macro definitions. This commit changes the `+` (1 or more) to `*` (0 or more), which matches how the `field` tokens are used in the simpler variants of the macro. --- tracing/src/macros.rs | 80 ++++++++++++++++++++--------------------- tracing/tests/macros.rs | 75 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 40 deletions(-) diff --git a/tracing/src/macros.rs b/tracing/src/macros.rs index 75ead0bcb7..ca841275a3 100644 --- a/tracing/src/macros.rs +++ b/tracing/src/macros.rs @@ -1307,10 +1307,10 @@ macro_rules! trace { $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::TRACE, { $($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::TRACE, { $($k).+ $($field)+ }) + $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::TRACE, { ?$($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, parent: $parent:expr, %$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::TRACE, { $($k).+ $($field)+ }) + $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::TRACE, { %$($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, parent: $parent:expr, $($arg:tt)+ ) => ( $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::TRACE, {}, $($arg)+) @@ -1324,10 +1324,10 @@ macro_rules! trace { $crate::event!(name: $name, target: $target, $crate::Level::TRACE, { $($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, ?$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, target: $target, $crate::Level::TRACE, { $($k).+ $($field)+ }) + $crate::event!(name: $name, target: $target, $crate::Level::TRACE, { ?$($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, %$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, target: $target, $crate::Level::TRACE, { $($k).+ $($field)+ }) + $crate::event!(name: $name, target: $target, $crate::Level::TRACE, { %$($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, $($arg:tt)+ ) => ( $crate::event!(name: $name, target: $target, $crate::Level::TRACE, {}, $($arg)+) @@ -1341,10 +1341,10 @@ macro_rules! trace { $crate::event!(target: $target, parent: $parent, $crate::Level::TRACE, { $($k).+ $($field)+ }) ); (target: $target:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(target: $target, parent: $parent, $crate::Level::TRACE, { $($k).+ $($field)+ }) + $crate::event!(target: $target, parent: $parent, $crate::Level::TRACE, { ?$($k).+ $($field)+ }) ); (target: $target:expr, parent: $parent:expr, %$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(target: $target, parent: $parent, $crate::Level::TRACE, { $($k).+ $($field)+ }) + $crate::event!(target: $target, parent: $parent, $crate::Level::TRACE, { %$($k).+ $($field)+ }) ); (target: $target:expr, parent: $parent:expr, $($arg:tt)+ ) => ( $crate::event!(target: $target, parent: $parent, $crate::Level::TRACE, {}, $($arg)+) @@ -1358,10 +1358,10 @@ macro_rules! trace { $crate::event!(name: $name, parent: $parent, $crate::Level::TRACE, { $($k).+ $($field)+ }) ); (name: $name:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, parent: $parent, $crate::Level::TRACE, { $($k).+ $($field)+ }) + $crate::event!(name: $name, parent: $parent, $crate::Level::TRACE, { ?$($k).+ $($field)+ }) ); (name: $name:expr, parent: $parent:expr, %$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, parent: $parent, $crate::Level::TRACE, { $($k).+ $($field)+ }) + $crate::event!(name: $name, parent: $parent, $crate::Level::TRACE, { %$($k).+ $($field)+ }) ); (name: $name:expr, parent: $parent:expr, $($arg:tt)+ ) => ( $crate::event!(name: $name, parent: $parent, $crate::Level::TRACE, {}, $($arg)+) @@ -1584,10 +1584,10 @@ macro_rules! debug { $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::DEBUG, { $($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::DEBUG, { $($k).+ $($field)+ }) + $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::DEBUG, { ?$($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, parent: $parent:expr, %$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::DEBUG, { $($k).+ $($field)+ }) + $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::DEBUG, { %$($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, parent: $parent:expr, $($arg:tt)+ ) => ( $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::DEBUG, {}, $($arg)+) @@ -1601,10 +1601,10 @@ macro_rules! debug { $crate::event!(name: $name, target: $target, $crate::Level::DEBUG, { $($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, ?$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, target: $target, $crate::Level::DEBUG, { $($k).+ $($field)+ }) + $crate::event!(name: $name, target: $target, $crate::Level::DEBUG, { ?$($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, %$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, target: $target, $crate::Level::DEBUG, { $($k).+ $($field)+ }) + $crate::event!(name: $name, target: $target, $crate::Level::DEBUG, { %$($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, $($arg:tt)+ ) => ( $crate::event!(name: $name, target: $target, $crate::Level::DEBUG, {}, $($arg)+) @@ -1618,10 +1618,10 @@ macro_rules! debug { $crate::event!(target: $target, parent: $parent, $crate::Level::DEBUG, { $($k).+ $($field)+ }) ); (target: $target:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(target: $target, parent: $parent, $crate::Level::DEBUG, { $($k).+ $($field)+ }) + $crate::event!(target: $target, parent: $parent, $crate::Level::DEBUG, { ?$($k).+ $($field)+ }) ); (target: $target:expr, parent: $parent:expr, %$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(target: $target, parent: $parent, $crate::Level::DEBUG, { $($k).+ $($field)+ }) + $crate::event!(target: $target, parent: $parent, $crate::Level::DEBUG, { %$($k).+ $($field)+ }) ); (target: $target:expr, parent: $parent:expr, $($arg:tt)+ ) => ( $crate::event!(target: $target, parent: $parent, $crate::Level::DEBUG, {}, $($arg)+) @@ -1635,10 +1635,10 @@ macro_rules! debug { $crate::event!(name: $name, parent: $parent, $crate::Level::DEBUG, { $($k).+ $($field)+ }) ); (name: $name:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, parent: $parent, $crate::Level::DEBUG, { $($k).+ $($field)+ }) + $crate::event!(name: $name, parent: $parent, $crate::Level::DEBUG, { ?$($k).+ $($field)+ }) ); (name: $name:expr, parent: $parent:expr, %$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, parent: $parent, $crate::Level::DEBUG, { $($k).+ $($field)+ }) + $crate::event!(name: $name, parent: $parent, $crate::Level::DEBUG, { %$($k).+ $($field)+ }) ); (name: $name:expr, parent: $parent:expr, $($arg:tt)+ ) => ( $crate::event!(name: $name, parent: $parent, $crate::Level::DEBUG, {}, $($arg)+) @@ -1872,10 +1872,10 @@ macro_rules! info { $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::INFO, { $($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::INFO, { $($k).+ $($field)+ }) + $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::INFO, { ?$($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, parent: $parent:expr, %$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::INFO, { $($k).+ $($field)+ }) + $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::INFO, { %$($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, parent: $parent:expr, $($arg:tt)+ ) => ( $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::INFO, {}, $($arg)+) @@ -1889,10 +1889,10 @@ macro_rules! info { $crate::event!(name: $name, target: $target, $crate::Level::INFO, { $($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, ?$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, target: $target, $crate::Level::INFO, { $($k).+ $($field)+ }) + $crate::event!(name: $name, target: $target, $crate::Level::INFO, { ?$($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, %$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, target: $target, $crate::Level::INFO, { $($k).+ $($field)+ }) + $crate::event!(name: $name, target: $target, $crate::Level::INFO, { %$($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, $($arg:tt)+ ) => ( $crate::event!(name: $name, target: $target, $crate::Level::INFO, {}, $($arg)+) @@ -1906,10 +1906,10 @@ macro_rules! info { $crate::event!(target: $target, parent: $parent, $crate::Level::INFO, { $($k).+ $($field)+ }) ); (target: $target:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(target: $target, parent: $parent, $crate::Level::INFO, { $($k).+ $($field)+ }) + $crate::event!(target: $target, parent: $parent, $crate::Level::INFO, { ?$($k).+ $($field)+ }) ); (target: $target:expr, parent: $parent:expr, %$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(target: $target, parent: $parent, $crate::Level::INFO, { $($k).+ $($field)+ }) + $crate::event!(target: $target, parent: $parent, $crate::Level::INFO, { %$($k).+ $($field)+ }) ); (target: $target:expr, parent: $parent:expr, $($arg:tt)+ ) => ( $crate::event!(target: $target, parent: $parent, $crate::Level::INFO, {}, $($arg)+) @@ -1923,10 +1923,10 @@ macro_rules! info { $crate::event!(name: $name, parent: $parent, $crate::Level::INFO, { $($k).+ $($field)+ }) ); (name: $name:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, parent: $parent, $crate::Level::INFO, { $($k).+ $($field)+ }) + $crate::event!(name: $name, parent: $parent, $crate::Level::INFO, { ?$($k).+ $($field)+ }) ); (name: $name:expr, parent: $parent:expr, %$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, parent: $parent, $crate::Level::INFO, { $($k).+ $($field)+ }) + $crate::event!(name: $name, parent: $parent, $crate::Level::INFO, { %$($k).+ $($field)+ }) ); (name: $name:expr, parent: $parent:expr, $($arg:tt)+ ) => ( $crate::event!(name: $name, parent: $parent, $crate::Level::INFO, {}, $($arg)+) @@ -2153,10 +2153,10 @@ macro_rules! warn { $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::WARN, { $($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::WARN, { $($k).+ $($field)+ }) + $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::WARN, { ?$($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, parent: $parent:expr, %$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::WARN, { $($k).+ $($field)+ }) + $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::WARN, { %$($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, parent: $parent:expr, $($arg:tt)+ ) => ( $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::WARN, {}, $($arg)+) @@ -2170,10 +2170,10 @@ macro_rules! warn { $crate::event!(name: $name, target: $target, $crate::Level::WARN, { $($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, ?$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, target: $target, $crate::Level::WARN, { $($k).+ $($field)+ }) + $crate::event!(name: $name, target: $target, $crate::Level::WARN, { ?$($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, %$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, target: $target, $crate::Level::WARN, { $($k).+ $($field)+ }) + $crate::event!(name: $name, target: $target, $crate::Level::WARN, { %$($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, $($arg:tt)+ ) => ( $crate::event!(name: $name, target: $target, $crate::Level::WARN, {}, $($arg)+) @@ -2187,10 +2187,10 @@ macro_rules! warn { $crate::event!(target: $target, parent: $parent, $crate::Level::WARN, { $($k).+ $($field)+ }) ); (target: $target:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(target: $target, parent: $parent, $crate::Level::WARN, { $($k).+ $($field)+ }) + $crate::event!(target: $target, parent: $parent, $crate::Level::WARN, { ?$($k).+ $($field)+ }) ); (target: $target:expr, parent: $parent:expr, %$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(target: $target, parent: $parent, $crate::Level::WARN, { $($k).+ $($field)+ }) + $crate::event!(target: $target, parent: $parent, $crate::Level::WARN, { %$($k).+ $($field)+ }) ); (target: $target:expr, parent: $parent:expr, $($arg:tt)+ ) => ( $crate::event!(target: $target, parent: $parent, $crate::Level::WARN, {}, $($arg)+) @@ -2204,10 +2204,10 @@ macro_rules! warn { $crate::event!(name: $name, parent: $parent, $crate::Level::WARN, { $($k).+ $($field)+ }) ); (name: $name:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, parent: $parent, $crate::Level::WARN, { $($k).+ $($field)+ }) + $crate::event!(name: $name, parent: $parent, $crate::Level::WARN, { ?$($k).+ $($field)+ }) ); (name: $name:expr, parent: $parent:expr, %$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, parent: $parent, $crate::Level::WARN, { $($k).+ $($field)+ }) + $crate::event!(name: $name, parent: $parent, $crate::Level::WARN, { %$($k).+ $($field)+ }) ); (name: $name:expr, parent: $parent:expr, $($arg:tt)+ ) => ( $crate::event!(name: $name, parent: $parent, $crate::Level::WARN, {}, $($arg)+) @@ -2430,10 +2430,10 @@ macro_rules! error { $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::ERROR, { $($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::ERROR, { $($k).+ $($field)+ }) + $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::ERROR, { ?$($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, parent: $parent:expr, %$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::ERROR, { $($k).+ $($field)+ }) + $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::ERROR, { %$($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, parent: $parent:expr, $($arg:tt)+ ) => ( $crate::event!(name: $name, target: $target, parent: $parent, $crate::Level::ERROR, {}, $($arg)+) @@ -2447,10 +2447,10 @@ macro_rules! error { $crate::event!(name: $name, target: $target, $crate::Level::ERROR, { $($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, ?$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, target: $target, $crate::Level::ERROR, { $($k).+ $($field)+ }) + $crate::event!(name: $name, target: $target, $crate::Level::ERROR, { ?$($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, %$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, target: $target, $crate::Level::ERROR, { $($k).+ $($field)+ }) + $crate::event!(name: $name, target: $target, $crate::Level::ERROR, { %$($k).+ $($field)+ }) ); (name: $name:expr, target: $target:expr, $($arg:tt)+ ) => ( $crate::event!(name: $name, target: $target, $crate::Level::ERROR, {}, $($arg)+) @@ -2464,10 +2464,10 @@ macro_rules! error { $crate::event!(target: $target, parent: $parent, $crate::Level::ERROR, { $($k).+ $($field)+ }) ); (target: $target:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(target: $target, parent: $parent, $crate::Level::ERROR, { $($k).+ $($field)+ }) + $crate::event!(target: $target, parent: $parent, $crate::Level::ERROR, { ?$($k).+ $($field)+ }) ); (target: $target:expr, parent: $parent:expr, %$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(target: $target, parent: $parent, $crate::Level::ERROR, { $($k).+ $($field)+ }) + $crate::event!(target: $target, parent: $parent, $crate::Level::ERROR, { %$($k).+ $($field)+ }) ); (target: $target:expr, parent: $parent:expr, $($arg:tt)+ ) => ( $crate::event!(target: $target, parent: $parent, $crate::Level::ERROR, {}, $($arg)+) @@ -2481,10 +2481,10 @@ macro_rules! error { $crate::event!(name: $name, parent: $parent, $crate::Level::ERROR, { $($k).+ $($field)+ }) ); (name: $name:expr, parent: $parent:expr, ?$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, parent: $parent, $crate::Level::ERROR, { $($k).+ $($field)+ }) + $crate::event!(name: $name, parent: $parent, $crate::Level::ERROR, { ?$($k).+ $($field)+ }) ); (name: $name:expr, parent: $parent:expr, %$($k:ident).+ $($field:tt)+ ) => ( - $crate::event!(name: $name, parent: $parent, $crate::Level::ERROR, { $($k).+ $($field)+ }) + $crate::event!(name: $name, parent: $parent, $crate::Level::ERROR, { %$($k).+ $($field)+ }) ); (name: $name:expr, parent: $parent:expr, $($arg:tt)+ ) => ( $crate::event!(name: $name, parent: $parent, $crate::Level::ERROR, {}, $($arg)+) diff --git a/tracing/tests/macros.rs b/tracing/tests/macros.rs index b6e568f4a6..e9966a5464 100644 --- a/tracing/tests/macros.rs +++ b/tracing/tests/macros.rs @@ -10,6 +10,16 @@ use tracing::{ span, span_enabled, trace, trace_span, warn, warn_span, Level, }; +/// A type that implements `Display` and `Debug`, but not `Value`. +#[derive(Debug)] +struct DisplayDebug; + +impl ::std::fmt::Display for DisplayDebug { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::std::write!(f, "Foo") + } +} + // Tests that macros work across various invocation syntax. // // These are quite repetitive, and _could_ be generated by a macro. However, @@ -581,6 +591,19 @@ fn trace() { trace!(target: "foo_events", ?foo, true, "message"); trace!(target: "foo_events", %foo, true, "message"); trace!(target: "foo_events", foo, true, "message"); + let foo = DisplayDebug; + trace!(?foo); + trace!(%foo); + trace!(name: "foo", ?foo); + trace!(name: "foo", %foo); + trace!(name: "foo", ?foo, true, "message"); + trace!(name: "foo", %foo, true, "message"); + trace!(target: "foo_events", ?foo); + trace!(target: "foo_events", %foo); + trace!(target: "foo_events", ?foo, true, "message"); + trace!(target: "foo_events", %foo, true, "message"); + trace!(name: "foo", target: "foo_events", ?foo, true, "message"); + trace!(name: "foo", target: "foo_events", %foo, true, "message"); } #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)] @@ -625,6 +648,19 @@ fn debug() { debug!(target: "foo_events", ?foo, true, "message"); debug!(target: "foo_events", %foo, true, "message"); debug!(target: "foo_events", foo, true, "message"); + let foo = DisplayDebug; + debug!(?foo); + debug!(%foo); + debug!(name: "foo", ?foo); + debug!(name: "foo", %foo); + debug!(name: "foo", ?foo, true, "message"); + debug!(name: "foo", %foo, true, "message"); + debug!(target: "foo_events", ?foo); + debug!(target: "foo_events", %foo); + debug!(target: "foo_events", ?foo, true, "message"); + debug!(target: "foo_events", %foo, true, "message"); + debug!(name: "foo", target: "foo_events", ?foo, true, "message"); + debug!(name: "foo", target: "foo_events", %foo, true, "message"); } #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)] @@ -669,6 +705,19 @@ fn info() { info!(target: "foo_events", ?foo, true, "message"); info!(target: "foo_events", %foo, true, "message"); info!(target: "foo_events", foo, true, "message"); + let foo = DisplayDebug; + info!(?foo); + info!(%foo); + info!(name: "foo", ?foo); + info!(name: "foo", %foo); + info!(name: "foo", ?foo, true, "message"); + info!(name: "foo", %foo, true, "message"); + info!(target: "foo_events", ?foo); + info!(target: "foo_events", %foo); + info!(target: "foo_events", ?foo, true, "message"); + info!(target: "foo_events", %foo, true, "message"); + info!(name: "foo", target: "foo_events", ?foo, true, "message"); + info!(name: "foo", target: "foo_events", %foo, true, "message"); } #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)] @@ -713,6 +762,19 @@ fn warn() { warn!(target: "foo_events", ?foo, true, "message"); warn!(target: "foo_events", %foo, true, "message"); warn!(target: "foo_events", foo, true, "message"); + let foo = DisplayDebug; + warn!(?foo); + warn!(%foo); + warn!(name: "foo", ?foo); + warn!(name: "foo", %foo); + warn!(name: "foo", ?foo, true, "message"); + warn!(name: "foo", %foo, true, "message"); + warn!(target: "foo_events", ?foo); + warn!(target: "foo_events", %foo); + warn!(target: "foo_events", ?foo, true, "message"); + warn!(target: "foo_events", %foo, true, "message"); + warn!(name: "foo", target: "foo_events", ?foo, true, "message"); + warn!(name: "foo", target: "foo_events", %foo, true, "message"); } #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)] @@ -757,6 +819,19 @@ fn error() { error!(target: "foo_events", ?foo, true, "message"); error!(target: "foo_events", %foo, true, "message"); error!(target: "foo_events", foo, true, "message"); + let foo = DisplayDebug; + error!(?foo); + error!(%foo); + error!(name: "foo", ?foo); + error!(name: "foo", %foo); + error!(name: "foo", ?foo, true, "message"); + error!(name: "foo", %foo, true, "message"); + error!(target: "foo_events", ?foo); + error!(target: "foo_events", %foo); + error!(target: "foo_events", ?foo, true, "message"); + error!(target: "foo_events", %foo, true, "message"); + error!(name: "foo", target: "foo_events", ?foo, true, "message"); + error!(name: "foo", target: "foo_events", %foo, true, "message"); } #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]