Skip to content

Commit 4ee56fa

Browse files
authored
room: rename the encrypted log field to is_room_encrypted (#3572)
1 parent c06b6d9 commit 4ee56fa

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

crates/matrix-sdk/src/room/futures.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ use ruma::{
3232
serde::Raw,
3333
OwnedTransactionId, TransactionId,
3434
};
35-
use tracing::{debug, info, Instrument, Span};
35+
#[cfg(feature = "image-proc")]
36+
use tracing::debug;
37+
use tracing::{info, trace, Instrument, Span};
3638

3739
use super::Room;
3840
#[cfg(feature = "image-proc")]
@@ -172,17 +174,17 @@ impl<'a> IntoFuture for SendRawMessageLikeEvent<'a> {
172174
Span::current().record("transaction_id", tracing::field::debug(&txn_id));
173175

174176
#[cfg(not(feature = "e2e-encryption"))]
175-
debug!("Sending plaintext event to room because we don't have encryption support.");
177+
trace!("Sending plaintext event to room because we don't have encryption support.");
176178

177179
#[cfg(feature = "e2e-encryption")]
178180
if room.is_encrypted().await? {
179-
Span::current().record("encrypted", true);
181+
Span::current().record("is_room_encrypted", true);
180182
// Reactions are currently famously not encrypted, skip encrypting
181183
// them until they are.
182184
if event_type == "m.reaction" {
183-
debug!("Sending plaintext event because of the event type.");
185+
trace!("Sending plaintext event because of the event type.");
184186
} else {
185-
debug!(
187+
trace!(
186188
room_id = ?room.room_id(),
187189
"Sending encrypted event because the room is encrypted.",
188190
);
@@ -210,8 +212,8 @@ impl<'a> IntoFuture for SendRawMessageLikeEvent<'a> {
210212
event_type = "m.room.encrypted";
211213
}
212214
} else {
213-
Span::current().record("encrypted", false);
214-
debug!("Sending plaintext event because the room is NOT encrypted.",);
215+
Span::current().record("is_room_encrypted", false);
216+
trace!("Sending plaintext event because the room is NOT encrypted.",);
215217
};
216218

217219
let request = send_message_event::v3::Request::new_raw(

crates/matrix-sdk/src/room/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1686,12 +1686,14 @@ impl Room {
16861686
/// }
16871687
/// # anyhow::Ok(()) };
16881688
/// ```
1689-
#[instrument(skip_all, fields(event_type, room_id = ?self.room_id(), transaction_id, encrypted, event_id))]
1689+
#[instrument(skip_all, fields(event_type, room_id = ?self.room_id(), transaction_id, is_room_encrypted, event_id))]
16901690
pub fn send_raw<'a>(
16911691
&'a self,
16921692
event_type: &'a str,
16931693
content: impl IntoRawMessageLikeEventContent,
16941694
) -> SendRawMessageLikeEvent<'a> {
1695+
// Note: the recorded instrument fields are saved in
1696+
// `SendRawMessageLikeEvent::into_future`.
16951697
SendRawMessageLikeEvent::new(self, event_type, content)
16961698
}
16971699

0 commit comments

Comments
 (0)