diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-04-07 20:04:55 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-04-07 20:04:55 +0200 |
commit | ecfbfe63508729e0e42cb3c7df8982d52cb6016f (patch) | |
tree | 7954832941826dbb121d1e69a5cfa526b6907ec9 | |
parent | 977454a7868f2988eef338f341ff9aef336b5102 (diff) |
lib: Add some minimal logging
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r-- | librepology/Cargo.toml | 2 | ||||
-rw-r--r-- | librepology/src/v1/api/request.rs | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/librepology/Cargo.toml b/librepology/Cargo.toml index ba4ef3e..b75464d 100644 --- a/librepology/Cargo.toml +++ b/librepology/Cargo.toml @@ -23,4 +23,6 @@ thiserror = "1" url = "1.7" url_serde = "0.2" getset = "0.1" +log = "0.4" +result-inspect = "0.2" diff --git a/librepology/src/v1/api/request.rs b/librepology/src/v1/api/request.rs index 50057c5..c797c74 100644 --- a/librepology/src/v1/api/request.rs +++ b/librepology/src/v1/api/request.rs @@ -1,3 +1,5 @@ +use result_inspect::*; + use crate::v1::api::ApiClient; use crate::v1::api::NumberOrRange; use crate::v1::api::ProjectRequestBuilderWithName; @@ -22,9 +24,11 @@ impl<'a, Output: serde::de::DeserializeOwned> Request<'a, Output> { .client .get(format!("{}{}", self.client.endpoint_url, self.request_string)) .send() - .await? + .await + .inspect(|response| log::debug!("Response: {:?}", response))? .text() .await + .inspect(|text| log::debug!("Response text: {:?}", text)) .map_err(RepologyError::from) .and_then(|data| serde_json::from_str(&data).map_err(RepologyError::from)) } |