From c30ec0ed8a84a18ec15f5ebcb043ffa10fd9abc7 Mon Sep 17 00:00:00 2001 From: Kevin Boos <1139460+kevinaboos@users.noreply.github.com> Date: Mon, 31 Mar 2025 08:11:06 -0700 Subject: [PATCH] chore(sdk): Reduce log verbosity from info -> trace in a few functions (#4747) At the default `INFO` log level, the log gets inundated with thousands of emitted statements, primarily related to `is_display_name_ambiguous()`. The execution of this tiny function certainly doesn't need to be traced every time, at least not at the info log level. Note: some of these could be debatably reduced to debug level rather than trace level, but I went with "trace" because they all seem to be trace statements rather than actual debug dump outputs (there is no actual program state dumped out). Signed-off-by: Kevin Boos [kevinaboos@gmail.com](mailto:kevinaboos@gmail.com) --------- Signed-off-by: Kevin Boos <1139460+kevinaboos@users.noreply.github.com> --- crates/matrix-sdk-base/src/store/ambiguity_map.rs | 2 +- crates/matrix-sdk-common/src/store_locks.rs | 6 +++--- crates/matrix-sdk-ui/src/timeline/builder.rs | 6 +++--- crates/matrix-sdk/src/send_queue/mod.rs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/matrix-sdk-base/src/store/ambiguity_map.rs b/crates/matrix-sdk-base/src/store/ambiguity_map.rs index 56888233f..da1f89d75 100644 --- a/crates/matrix-sdk-base/src/store/ambiguity_map.rs +++ b/crates/matrix-sdk-base/src/store/ambiguity_map.rs @@ -86,7 +86,7 @@ pub(crate) struct AmbiguityCache { pub changes: BTreeMap>, } -#[instrument(ret)] +#[instrument(ret(level = "trace"))] pub(crate) fn is_display_name_ambiguous( display_name: &DisplayName, users_with_display_name: &BTreeSet, diff --git a/crates/matrix-sdk-common/src/store_locks.rs b/crates/matrix-sdk-common/src/store_locks.rs index 4d680771e..d01cbc031 100644 --- a/crates/matrix-sdk-common/src/store_locks.rs +++ b/crates/matrix-sdk-common/src/store_locks.rs @@ -47,7 +47,7 @@ use std::{ }; use tokio::sync::Mutex; -use tracing::{debug, error, info, instrument, trace}; +use tracing::{debug, error, instrument, trace}; use crate::{ executor::{spawn, JoinHandle}, @@ -216,7 +216,7 @@ impl CrossProcessStoreLock< if let Some(_prev) = renew_task.take() { #[cfg(not(target_arch = "wasm32"))] if !_prev.is_finished() { - info!("aborting the previous renew task"); + trace!("aborting the previous renew task"); _prev.abort(); } } @@ -238,7 +238,7 @@ impl CrossProcessStoreLock< // If there are no more users, we can quit. if this.num_holders.load(atomic::Ordering::SeqCst) == 0 { - info!("exiting the lease extension loop"); + trace!("exiting the lease extension loop"); // Cancel the lease with another 0ms lease. // If we don't get the lock, that's (weird but) fine. diff --git a/crates/matrix-sdk-ui/src/timeline/builder.rs b/crates/matrix-sdk-ui/src/timeline/builder.rs index 5b2d5c157..1a78dce4a 100644 --- a/crates/matrix-sdk-ui/src/timeline/builder.rs +++ b/crates/matrix-sdk-ui/src/timeline/builder.rs @@ -30,7 +30,7 @@ use matrix_sdk::{ use ruma::{events::AnySyncTimelineEvent, OwnedEventId, RoomVersionId}; use tokio::sync::broadcast::{error::RecvError, Receiver}; use tokio_stream::wrappers::errors::BroadcastStreamRecvError; -use tracing::{info, info_span, trace, warn, Instrument, Span}; +use tracing::{info_span, trace, warn, Instrument, Span}; use super::{ controller::{TimelineController, TimelineSettings}, @@ -423,7 +423,7 @@ async fn room_send_queue_update_task( mut send_queue_stream: Receiver, timeline_controller: TimelineController, ) { - info!("spawned the local echo task!"); + trace!("spawned the local echo task!"); loop { match send_queue_stream.recv().await { @@ -434,7 +434,7 @@ async fn room_send_queue_update_task( } Err(RecvError::Closed) => { - info!("channel closed, exiting the local echo handler"); + trace!("channel closed, exiting the local echo handler"); break; } } diff --git a/crates/matrix-sdk/src/send_queue/mod.rs b/crates/matrix-sdk/src/send_queue/mod.rs index 9a1241c07..4469227cf 100644 --- a/crates/matrix-sdk/src/send_queue/mod.rs +++ b/crates/matrix-sdk/src/send_queue/mod.rs @@ -522,7 +522,7 @@ impl RoomSendQueue { global_error_reporter: broadcast::Sender, is_dropping: Arc, ) { - info!("spawned the sending task"); + trace!("spawned the sending task"); loop { // A request to shut down should be preferred above everything else.