From 8de1c652d39cee33ac0659d0114b904d51978598 Mon Sep 17 00:00:00 2001 From: Jesse de Wit Date: Mon, 7 Oct 2024 20:55:37 +0200 Subject: [PATCH 1/2] improve log levels --- libs/sdk-common/src/utils/rest_client.rs | 4 ++-- libs/sdk-core/src/breez_services.rs | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/libs/sdk-common/src/utils/rest_client.rs b/libs/sdk-common/src/utils/rest_client.rs index f9638d23d..b3052c63c 100644 --- a/libs/sdk-common/src/utils/rest_client.rs +++ b/libs/sdk-common/src/utils/rest_client.rs @@ -23,7 +23,7 @@ pub async fn post_and_log_response( req = req.body(body); } let raw_body = req.send().await?.text().await?; - debug!("Received raw response body: {raw_body}"); + trace!("Received raw response body: {raw_body}"); Ok(raw_body) } @@ -40,7 +40,7 @@ pub async fn get_and_log_response( let response = get_reqwest_client()?.get(url).send().await?; let status = response.status(); let raw_body = response.text().await?; - debug!("Received response, status: {status}, raw response body: {raw_body}"); + trace!("Received response, status: {status}, raw response body: {raw_body}"); Ok((raw_body, status)) } diff --git a/libs/sdk-core/src/breez_services.rs b/libs/sdk-core/src/breez_services.rs index 63806917d..9ec9c368b 100644 --- a/libs/sdk-core/src/breez_services.rs +++ b/libs/sdk-core/src/breez_services.rs @@ -1805,11 +1805,9 @@ impl BreezServices { .target(env_logger::Target::Pipe(target_log_file)) .parse_filters( r#" - debug, - breez_sdk_core::input_parser=warn, - breez_sdk_core::backup=info, - breez_sdk_core::persist::reverseswap=info, - breez_sdk_core::reverseswap=info, + info, + breez_sdk_core=debug, + sdk_common=debug, gl_client=debug, h2=warn, hyper=warn, From 318ef7d72f1350a4fa610e3d27c842605d55cf0f Mon Sep 17 00:00:00 2001 From: Jesse de Wit Date: Fri, 11 Oct 2024 12:00:33 +0200 Subject: [PATCH 2/2] log response status in debug level --- libs/sdk-common/src/utils/rest_client.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libs/sdk-common/src/utils/rest_client.rs b/libs/sdk-common/src/utils/rest_client.rs index b3052c63c..e4a1d4a6c 100644 --- a/libs/sdk-common/src/utils/rest_client.rs +++ b/libs/sdk-common/src/utils/rest_client.rs @@ -22,8 +22,11 @@ pub async fn post_and_log_response( if let Some(body) = body { req = req.body(body); } - let raw_body = req.send().await?.text().await?; - trace!("Received raw response body: {raw_body}"); + let response = req.send().await?; + let status = response.status(); + let raw_body = response.text().await?; + debug!("Received response, status: {status}"); + trace!("raw response body: {raw_body}"); Ok(raw_body) } @@ -40,7 +43,8 @@ pub async fn get_and_log_response( let response = get_reqwest_client()?.get(url).send().await?; let status = response.status(); let raw_body = response.text().await?; - trace!("Received response, status: {status}, raw response body: {raw_body}"); + debug!("Received response, status: {status}"); + trace!("raw response body: {raw_body}"); Ok((raw_body, status)) }