diff --git a/Cargo.toml b/Cargo.toml index b61f79f..5af2220 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,10 +19,12 @@ edition = "2018" [dependencies] failure = "0.1" +log = "0.4.*" reqwest = { version = "^0.9", features = ["rustls-tls"] } serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" [dev-dependencies] +env_logger = { version = "0.7.*" } spectral = "0.6.0" diff --git a/examples/get_station_data.rs b/examples/get_station_data.rs index 581cf12..4e41262 100644 --- a/examples/get_station_data.rs +++ b/examples/get_station_data.rs @@ -2,6 +2,8 @@ use netatmo_rs::{ClientCredentials, Netatmo, NetatmoClient, Scope}; use std::env; fn main() { + env_logger::init(); + let client_id = env::var_os("NETATMO_CLIENT_ID") .expect("Environment variable 'NETATMO_CLIENT_ID' is not set.") .to_string_lossy() diff --git a/src/client.rs b/src/client.rs index bf14e6b..3817c12 100644 --- a/src/client.rs +++ b/src/client.rs @@ -1,6 +1,7 @@ use std::collections::HashMap; use failure::Fail; +use log::trace; use reqwest::{Response, StatusCode}; use serde::de::DeserializeOwned; use serde::Deserialize; @@ -108,6 +109,7 @@ where .general_err_handler(name, StatusCode::OK)?; let body = res.text().map_err(|e| e.context(ErrorKind::FailedToReadResponse))?; + trace!("Sucessful ({:?}) repsone: '{}'", res.status(), body); serde_json::from_str::(&body).map_err(|e| e.context(ErrorKind::JsonDeserializationFailed).into()) }