From 959c559bd8e5bfce7eeab7f9629bc66efff0325c Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 18 Dec 2025 17:12:47 +0000 Subject: [PATCH] Log all ruma handler results at trace level. Signed-off-by: Jason Volk --- src/api/client/relations.rs | 3 +-- src/api/client/sync/v3.rs | 1 - src/api/router/handler.rs | 11 ++++++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/api/client/relations.rs b/src/api/client/relations.rs index 21bf3696..a5a5286d 100644 --- a/src/api/client/relations.rs +++ b/src/api/client/relations.rs @@ -113,8 +113,7 @@ pub(crate) async fn get_relating_events_route( name = "relations", level = "debug", skip_all, - fields(room_id, target, from, to, dir, limit, recurse), - ret(level = "trace") + fields(room_id, target, from, to, dir, limit, recurse) )] async fn paginate_relations_with_filter( services: &Services, diff --git a/src/api/client/sync/v3.rs b/src/api/client/sync/v3.rs index f5f31dd0..1e83e092 100644 --- a/src/api/client/sync/v3.rs +++ b/src/api/client/sync/v3.rs @@ -263,7 +263,6 @@ async fn build_empty_response( #[tracing::instrument( name = "build", level = INFO_SPAN_LEVEL, - ret(level = "trace"), skip_all, fields( %since, diff --git a/src/api/router/handler.rs b/src/api/router/handler.rs index 0738f9d1..b6acee8b 100644 --- a/src/api/router/handler.rs +++ b/src/api/router/handler.rs @@ -9,7 +9,7 @@ use axum::{ use futures::{Future, TryFutureExt}; use http::Method; use ruma::api::IncomingRequest; -use tuwunel_core::Result; +use tuwunel_core::{Result, trace}; use super::{Ruma, RumaResponse, State}; @@ -42,7 +42,7 @@ macro_rules! ruma_handler { Fut: Future> + Send, Req: IncomingRequest + Debug + Send + Sync + 'static, Err: IntoResponse + Debug + Send, - ::OutgoingResponse: Send, + ::OutgoingResponse: Debug + Send, $( $tx: FromRequestParts + Send + Sync + 'static, )* { fn add_routes(&'static self, router: Router) -> Router { @@ -53,8 +53,13 @@ macro_rules! ruma_handler { } fn add_route(&'static self, router: Router, path: &str) -> Router { - let action = |$($tx,)* req| self($($tx,)* req).map_ok(RumaResponse); let method = method_to_filter(&Req::METADATA.method); + let action = |$($tx,)* req| { + self($($tx,)* req) + .inspect_ok(|result| trace!(?result)) + .map_ok(RumaResponse) + }; + router.route(path, on(method, action)) } }