Log all ruma handler results at trace level.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-12-18 17:12:47 +00:00
parent a1bf188504
commit 959c559bd8
3 changed files with 9 additions and 6 deletions

View File

@@ -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,

View File

@@ -263,7 +263,6 @@ async fn build_empty_response(
#[tracing::instrument(
name = "build",
level = INFO_SPAN_LEVEL,
ret(level = "trace"),
skip_all,
fields(
%since,

View File

@@ -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<Output = Result<Req::OutgoingResponse, Err>> + Send,
Req: IncomingRequest + Debug + Send + Sync + 'static,
Err: IntoResponse + Debug + Send,
<Req as IncomingRequest>::OutgoingResponse: Send,
<Req as IncomingRequest>::OutgoingResponse: Debug + Send,
$( $tx: FromRequestParts<State> + Send + Sync + 'static, )*
{
fn add_routes(&'static self, router: Router<State>) -> Router<State> {
@@ -53,8 +53,13 @@ macro_rules! ruma_handler {
}
fn add_route(&'static self, router: Router<State>, path: &str) -> Router<State> {
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))
}
}