summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh McKinney <joshka@users.noreply.github.com>2023-04-12 21:45:15 -0700
committerD. Scott Boggs <scott@tams.tech>2023-09-01 07:53:32 -0400
commitad76c52428f09880966b9774ec454b00a2c7331f (patch)
tree6c70c3377ad1dd9b14ce5685cc43c0e3d0c0382b
parent89e9091afb50013d94ab5ef04a18ea58b122d28a (diff)
fix: log using Debug from read_response too
Now the other T implements Debug too for logging
-rw-r--r--src/helpers/read_response.rs6
-rw-r--r--src/macros.rs6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/helpers/read_response.rs b/src/helpers/read_response.rs
index ebf87bc..a693f83 100644
--- a/src/helpers/read_response.rs
+++ b/src/helpers/read_response.rs
@@ -1,4 +1,4 @@
-use std::time::Duration;
+use std::{time::Duration, fmt::Debug};
use crate::{errors::Result, Error};
use futures::pin_mut;
@@ -16,7 +16,7 @@ use tracing::{debug, trace, warn};
/// to parse whatever we got before the timeout.
pub async fn read_response<T>(response: Response) -> Result<T>
where
- T: for<'de> Deserialize<'de> + Serialize,
+ T: for<'de> Deserialize<'de> + Serialize + Debug,
{
let mut bytes = vec![];
let url = response.url().clone();
@@ -59,7 +59,7 @@ where
let result = serde_json::from_slice(bytes)?;
debug!(
url = url.as_str(),
- //result = result.serialize(),
+ ?result,
"result parsed successfully"
);
Ok(result)
diff --git a/src/macros.rs b/src/macros.rs
index 4c02255..1e2c5ff 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -3,7 +3,7 @@ macro_rules! methods {
$(
#[allow(dead_code)]
#[doc=concat!("Make a ", stringify!($method), " API request, and deserialize the result into T")]
- async fn $method<T: for<'de> serde::Deserialize<'de> + serde::Serialize>(&self, url: impl AsRef<str>) -> Result<T>
+ async fn $method<T: for<'de> serde::Deserialize<'de> + serde::Serialize + std::fmt::Debug>(&self, url: impl AsRef<str>) -> Result<T>
{
let call_id = uuid::Uuid::new_v4();
self.$method_with_call_id(url, call_id).await
@@ -14,7 +14,7 @@ macro_rules! methods {
"Make a ", stringify!($method), " API request, and deserialize the result into T.\n\n",
"Logging will use the provided UUID, rather than generating one before making the request.",
)]
- async fn $method_with_call_id<T: for<'de> serde::Deserialize<'de> + serde::Serialize>(&self, url: impl AsRef<str>, call_id: Uuid) -> Result<T>
+ async fn $method_with_call_id<T: for<'de> serde::Deserialize<'de> + serde::Serialize + std::fmt::Debug>(&self, url: impl AsRef<str>, call_id: Uuid) -> Result<T>
{
use tracing::debug;
@@ -649,4 +649,4 @@ tokio_test::block_on(async {
streaming! { $($rest)* }
};
() => {}
-}
+} \ No newline at end of file