diff --git a/src/config/watch/agones/crd.rs b/src/config/watch/agones/crd.rs index 4acf561de1..6c7ed78171 100644 --- a/src/config/watch/agones/crd.rs +++ b/src/config/watch/agones/crd.rs @@ -55,7 +55,7 @@ impl<'de> serde::Deserialize<'de> for GameServer { serde_json::from_value::(value.clone()) .map_err(|error| { - tracing::trace!(%error, ?value, "gameserver failed"); + tracing::trace!(%error, %value, "gameserver failed"); Error::custom(error) }) .map( diff --git a/src/filters/capture.rs b/src/filters/capture.rs index b4aa18db46..e87ccba485 100644 --- a/src/filters/capture.rs +++ b/src/filters/capture.rs @@ -67,7 +67,7 @@ impl Filter for Capture { .insert(self.is_present_key.clone(), Value::Bool(capture.is_some())); if let Some(value) = capture { - tracing::trace!(key=&**self.metadata_key, value=?value, "captured value"); + tracing::trace!(key=&**self.metadata_key, %value, "captured value"); ctx.metadata.insert(self.metadata_key.clone(), value); Some(ctx.into()) } else { diff --git a/src/filters/match.rs b/src/filters/match.rs index e3c6f35fdc..46659fa110 100644 --- a/src/filters/match.rs +++ b/src/filters/match.rs @@ -101,7 +101,7 @@ where match config.branches.iter().find(|(key, _)| key == value) { Some((value, instance)) => { - tracing::trace!(key=&*config.metadata_key, value=?value, filter=&*instance.0, "Matched against branch"); + tracing::trace!(key=&*config.metadata_key, %value, filter=&*instance.0, "Matched against branch"); metrics.packets_matched_total.inc(); (and_then)(ctx, &instance.1) } diff --git a/src/filters/token_router.rs b/src/filters/token_router.rs index f262cffa11..40f4d3fefb 100644 --- a/src/filters/token_router.rs +++ b/src/filters/token_router.rs @@ -85,7 +85,10 @@ impl Filter for TokenRouter { if ctx.endpoints.is_empty() { let token: &[u8] = &**token; - tracing::trace!(?token, "No endpoint matched token"); + tracing::trace!( + token = &*base64::encode(token), + "No endpoint matched token" + ); self.metrics.packets_dropped_no_endpoint_match.inc(); None } else { diff --git a/src/metadata.rs b/src/metadata.rs index ae857be368..3301ddec85 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -69,6 +69,32 @@ impl Value { } } +impl std::fmt::Display for Value { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match &self { + Self::Bool(value) => value.fmt(f), + Self::Number(value) => value.fmt(f), + Self::String(value) => value.fmt(f), + Self::Bytes(value) => base64::encode(value).fmt(f), + Self::List(values) => { + write!(f, "[")?; + let mut first = true; + for value in values { + if first { + first = false; + } else { + write!(f, ",")?; + } + + value.fmt(f)?; + } + + write!(f, "]") + } + } + } +} + /// Convenience macro for generating From implementations. macro_rules! from_value { (($name:ident) { $($typ:ty => $ex:expr),+ $(,)? }) => {