Log crate

This commit is contained in:
daladim 2021-02-21 00:14:55 +01:00
parent 6c94881b5a
commit 0f081f78b4
2 changed files with 6 additions and 2 deletions

View file

@ -7,6 +7,8 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
env_logger = "0.8"
log = "0.4"
tokio = { version = "1.2", features = ["macros", "rt"]} tokio = { version = "1.2", features = ["macros", "rt"]}
uuid = "0.8" uuid = "0.8"
reqwest = "0.11" reqwest = "0.11"

View file

@ -100,7 +100,7 @@ impl Client {
let mut principal_url = self.url.clone(); let mut principal_url = self.url.clone();
principal_url.set_path(&href); principal_url.set_path(&href);
self.principal = Some(principal_url.clone()); self.principal = Some(principal_url.clone());
println!("URL is {}", href); log::debug!("Principal URL is {}", href);
return Ok(principal_url); return Ok(principal_url);
} }
@ -116,7 +116,7 @@ impl Client {
let mut chs_url = self.url.clone(); let mut chs_url = self.url.clone();
chs_url.set_path(&href); chs_url.set_path(&href);
self.calendar_home_set = Some(chs_url.clone()); self.calendar_home_set = Some(chs_url.clone());
println!("Calendar home set {:?}", chs_url.path()); log::debug!("Calendar home set URL is {:?}", chs_url.path());
Ok(chs_url) Ok(chs_url)
} }
@ -205,6 +205,8 @@ mod test {
#[tokio::test] #[tokio::test]
async fn test_client() { async fn test_client() {
let _ = env_logger::builder().is_test(true).try_init();
let mut client = Client::new(URL, USERNAME, PASSWORD).unwrap(); let mut client = Client::new(URL, USERNAME, PASSWORD).unwrap();
client.get_calendars_url().await.unwrap(); client.get_calendars_url().await.unwrap();
} }