Log curl command line for all requests at trace

This commit is contained in:
Lambda 2024-09-03 20:35:09 +00:00 committed by Charles Hall
parent b0f33207fe
commit 5c4062742f
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
3 changed files with 103 additions and 19 deletions

View file

@ -64,7 +64,7 @@ use ruma::{
};
use serde_json::value::{to_raw_value, RawValue as RawJsonValue};
use tokio::sync::RwLock;
use tracing::{debug, error, field, warn};
use tracing::{debug, error, field, trace, trace_span, warn};
use super::appservice_server;
use crate::{
@ -253,6 +253,14 @@ where
signature,
)));
// can be enabled selectively using `filter =
// grapevine[outgoing_request_curl]=trace` in config
trace_span!("outgoing_request_curl").in_scope(|| {
trace!(
cmd = utils::curlify(&http_request),
"curl command line for outgoing request"
);
});
let reqwest_request = reqwest::Request::try_from(http_request)?;
let url = reqwest_request.url().clone();