Log all ruma handler results at trace level.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -113,8 +113,7 @@ pub(crate) async fn get_relating_events_route(
|
|||||||
name = "relations",
|
name = "relations",
|
||||||
level = "debug",
|
level = "debug",
|
||||||
skip_all,
|
skip_all,
|
||||||
fields(room_id, target, from, to, dir, limit, recurse),
|
fields(room_id, target, from, to, dir, limit, recurse)
|
||||||
ret(level = "trace")
|
|
||||||
)]
|
)]
|
||||||
async fn paginate_relations_with_filter(
|
async fn paginate_relations_with_filter(
|
||||||
services: &Services,
|
services: &Services,
|
||||||
|
|||||||
@@ -263,7 +263,6 @@ async fn build_empty_response(
|
|||||||
#[tracing::instrument(
|
#[tracing::instrument(
|
||||||
name = "build",
|
name = "build",
|
||||||
level = INFO_SPAN_LEVEL,
|
level = INFO_SPAN_LEVEL,
|
||||||
ret(level = "trace"),
|
|
||||||
skip_all,
|
skip_all,
|
||||||
fields(
|
fields(
|
||||||
%since,
|
%since,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use axum::{
|
|||||||
use futures::{Future, TryFutureExt};
|
use futures::{Future, TryFutureExt};
|
||||||
use http::Method;
|
use http::Method;
|
||||||
use ruma::api::IncomingRequest;
|
use ruma::api::IncomingRequest;
|
||||||
use tuwunel_core::Result;
|
use tuwunel_core::{Result, trace};
|
||||||
|
|
||||||
use super::{Ruma, RumaResponse, State};
|
use super::{Ruma, RumaResponse, State};
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ macro_rules! ruma_handler {
|
|||||||
Fut: Future<Output = Result<Req::OutgoingResponse, Err>> + Send,
|
Fut: Future<Output = Result<Req::OutgoingResponse, Err>> + Send,
|
||||||
Req: IncomingRequest + Debug + Send + Sync + 'static,
|
Req: IncomingRequest + Debug + Send + Sync + 'static,
|
||||||
Err: IntoResponse + Debug + Send,
|
Err: IntoResponse + Debug + Send,
|
||||||
<Req as IncomingRequest>::OutgoingResponse: Send,
|
<Req as IncomingRequest>::OutgoingResponse: Debug + Send,
|
||||||
$( $tx: FromRequestParts<State> + Send + Sync + 'static, )*
|
$( $tx: FromRequestParts<State> + Send + Sync + 'static, )*
|
||||||
{
|
{
|
||||||
fn add_routes(&'static self, router: Router<State>) -> Router<State> {
|
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> {
|
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 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))
|
router.route(path, on(method, action))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user