network: avoid putting null bytes in trace output

This commit is contained in:
Henry de Valence 2020-12-01 12:54:24 -08:00
parent f93deb1cac
commit 5ccd1905fc
1 changed files with 6 additions and 1 deletions

View File

@ -320,7 +320,12 @@ impl Decoder for Codec {
trace!( trace!(
?self.state, ?self.state,
?magic, ?magic,
command = %String::from_utf8_lossy(&command), command = %String::from_utf8(
command.iter()
.cloned()
.flat_map(std::ascii::escape_default)
.collect()
).unwrap(),
body_len, body_len,
?checksum, ?checksum,
"read header from src buffer" "read header from src buffer"