From 0f081f78b43c42f10d4ca9d31b9b2549d43b1eb6 Mon Sep 17 00:00:00 2001 From: daladim Date: Sun, 21 Feb 2021 00:14:55 +0100 Subject: [PATCH] Log crate --- Cargo.toml | 2 ++ src/data/client.rs | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e72b89a..da96375 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,8 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +env_logger = "0.8" +log = "0.4" tokio = { version = "1.2", features = ["macros", "rt"]} uuid = "0.8" reqwest = "0.11" diff --git a/src/data/client.rs b/src/data/client.rs index 798d4dd..f3f3653 100644 --- a/src/data/client.rs +++ b/src/data/client.rs @@ -100,7 +100,7 @@ impl Client { let mut principal_url = self.url.clone(); principal_url.set_path(&href); self.principal = Some(principal_url.clone()); - println!("URL is {}", href); + log::debug!("Principal URL is {}", href); return Ok(principal_url); } @@ -116,7 +116,7 @@ impl Client { let mut chs_url = self.url.clone(); chs_url.set_path(&href); 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) } @@ -205,6 +205,8 @@ mod test { #[tokio::test] async fn test_client() { + let _ = env_logger::builder().is_test(true).try_init(); + let mut client = Client::new(URL, USERNAME, PASSWORD).unwrap(); client.get_calendars_url().await.unwrap(); }