From 3e3287abe63182c9c9ff1ecdb685031ed6d71820 Mon Sep 17 00:00:00 2001 From: Ruben De Smet Date: Sun, 7 Jan 2024 14:19:05 +0100 Subject: [PATCH] Short debug format for empty Envelopes --- libsignal-service/src/cipher.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/libsignal-service/src/cipher.rs b/libsignal-service/src/cipher.rs index 34477875c..fec99acfa 100644 --- a/libsignal-service/src/cipher.rs +++ b/libsignal-service/src/cipher.rs @@ -47,20 +47,24 @@ impl fmt::Debug for ServiceCipher { } fn debug_envelope(envelope: &Envelope) -> String { - format!( - "Envelope {{ \ + if envelope.content.is_none() { + "Envelope { empty }".to_string() + } else { + format!( + "Envelope {{ \ source_address: {:?}, \ source_device: {:?}, \ server_guid: {:?}, \ timestamp: {:?}, \ content: {} bytes, \ }}", - envelope.source_address(), - envelope.source_device(), - envelope.server_guid(), - envelope.timestamp(), - envelope.content().len(), - ) + envelope.source_address(), + envelope.source_device(), + envelope.server_guid(), + envelope.timestamp(), + envelope.content().len(), + ) + } } impl ServiceCipher