From 30640ebb6552c85ffb2084efaee18508b61fa221 Mon Sep 17 00:00:00 2001 From: Valere Date: Mon, 26 Feb 2024 11:40:38 +0100 Subject: [PATCH] sdk: Log the successful room message sending and record the received event ID --- crates/matrix-sdk/src/room/futures.rs | 6 +++++- crates/matrix-sdk/src/room/mod.rs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/matrix-sdk/src/room/futures.rs b/crates/matrix-sdk/src/room/futures.rs index ebe2b6f05..b599df1d5 100644 --- a/crates/matrix-sdk/src/room/futures.rs +++ b/crates/matrix-sdk/src/room/futures.rs @@ -32,7 +32,7 @@ use ruma::{ serde::Raw, OwnedTransactionId, TransactionId, }; -use tracing::{debug, Instrument, Span}; +use tracing::{debug, info, Instrument, Span}; use super::Room; use crate::{ @@ -201,6 +201,10 @@ impl<'a> IntoFuture for SendRawMessageLikeEvent<'a> { ); let response = room.client.send(request, None).await?; + + tracing::Span::current().record("event_id", tracing::field::debug(&response.event_id)); + info!("Sent event in room"); + Ok(response) }; diff --git a/crates/matrix-sdk/src/room/mod.rs b/crates/matrix-sdk/src/room/mod.rs index 5a3571297..6dd09cfd5 100644 --- a/crates/matrix-sdk/src/room/mod.rs +++ b/crates/matrix-sdk/src/room/mod.rs @@ -1652,7 +1652,7 @@ impl Room { /// } /// # anyhow::Ok(()) }; /// ``` - #[instrument(skip_all, fields(event_type, room_id = ?self.room_id(), transaction_id, encrypted))] + #[instrument(skip_all, fields(event_type, room_id = ?self.room_id(), transaction_id, encrypted, event_id))] pub fn send_raw<'a>( &'a self, event_type: &'a str,