Skip to content

Commit

Permalink
Logging cleanup (#866)
Browse files Browse the repository at this point in the history
* Logging cleanup

* Switch to debug level
  • Loading branch information
neekolas authored Jun 24, 2024
1 parent 786324a commit 4f932ce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 4 additions & 1 deletion xmtp_mls/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ pub enum MessageProcessingError {
impl crate::retry::RetryableError for MessageProcessingError {
fn is_retryable(&self) -> bool {
match self {
Self::Storage(s) => s.is_retryable(),
Self::Group(group_error) => retryable!(group_error),
Self::Identity(identity_error) => retryable!(identity_error),
Self::Diesel(diesel_error) => retryable!(diesel_error),
Self::Storage(s) => retryable!(s),
Self::Generic(err) => err.contains("database is locked"),
_ => false,
}
Expand Down
8 changes: 4 additions & 4 deletions xmtp_mls/src/groups/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl MlsGroup {
self.sync_with_conn(conn, client).await
}

#[tracing::instrument(level = "trace", skip(client, conn))]
#[tracing::instrument(level = "trace", skip(client, self, conn))]
pub(super) async fn sync_with_conn<ApiClient>(
&self,
conn: DbConnection,
Expand Down Expand Up @@ -141,7 +141,7 @@ impl MlsGroup {
*
* This method will retry up to `crate::configuration::MAX_GROUP_SYNC_RETRIES` times.
*/
#[tracing::instrument(level = "trace", skip(client, conn))]
#[tracing::instrument(level = "trace", skip(client, self, conn))]
pub(super) async fn sync_until_intent_resolved<ApiClient>(
&self,
conn: DbConnection,
Expand Down Expand Up @@ -678,7 +678,7 @@ impl MlsGroup {
}
}

#[tracing::instrument(level = "trace", skip(conn, client))]
#[tracing::instrument(level = "trace", skip(conn, client, self))]
pub(super) async fn receive<ApiClient>(
&self,
conn: &DbConnection,
Expand Down Expand Up @@ -740,7 +740,7 @@ impl MlsGroup {
Ok(Some(msg))
}

#[tracing::instrument(level = "trace", skip(conn, client))]
#[tracing::instrument(level = "trace", skip(conn, self, client))]
pub(super) async fn publish_intents<ClientApi>(
&self,
conn: DbConnection,
Expand Down
3 changes: 2 additions & 1 deletion xmtp_mls/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ pub trait Delete<Model> {

#[cfg(test)]
mod tests {
use log::LevelFilter;
use tracing_test::traced_test;

// Execute once before any tests are run
Expand All @@ -68,7 +69,7 @@ mod tests {
#[traced_test]
fn setup() {
// Capture logs (e.g. log::info!()) as traces too
let _ = tracing_log::LogTracer::init();
let _ = tracing_log::LogTracer::init_with_filter(LevelFilter::Debug);
}

/// Note: tests that use this must have the #[traced_test] attribute
Expand Down

0 comments on commit 4f932ce

Please sign in to comment.