diff --git a/src/feedreader.rs b/src/feedreader.rs index a07837d..5dd2b8c 100644 --- a/src/feedreader.rs +++ b/src/feedreader.rs @@ -56,7 +56,7 @@ pub async fn fetch_and_parse_feed(uri: &str) -> Result> { let http_client = reqwest::Client::builder().default_headers(headers).build()?; let response = http_client.get(uri).send().await?.text().await?; - info!("Got response, parsing feed from {}", uri); + debug!("Got response, parsing feed from {}", uri); let feed = parser::parse(response.as_bytes())?; let feed_title = match feed.title.clone() { @@ -64,7 +64,7 @@ pub async fn fetch_and_parse_feed(uri: &str) -> Result> { None => String::from("Untitled") }; - info!("Got feed with title \"{}\"", feed_title); + debug!("Got feed with title \"{}\"", feed_title); Ok(Feed { uri: String::from(uri), diff --git a/src/state.rs b/src/state.rs index 0cd5cea..06c02dd 100644 --- a/src/state.rs +++ b/src/state.rs @@ -25,7 +25,7 @@ use std::{ use tokio::fs; use chrono::{ DateTime, Utc }; -use tracing::{ info }; +use tracing::{ info, debug }; use serde_yaml::mapping::Mapping as FeedReaderState; @@ -55,17 +55,16 @@ impl FeedReaderStateDb { ) -> () { { - info!("Updating feed reader state"); + debug!("Updating feed reader state"); self.state.lock().unwrap().insert(uri.into(), dt.timestamp().into()); } - info!("Persisting feed reader state"); self.persist().await.unwrap(); } #[tracing::instrument(ret, level="debug")] pub fn get(&self, uri: &str) -> Option> { - info!("Retrieving state for feed {}", uri); + debug!("Retrieving state for feed {}", uri); match self.state.lock().unwrap().get(uri) { Some(t) => DateTime::from_timestamp((*t).as_i64().unwrap(), 0), None => None @@ -79,6 +78,7 @@ impl FeedReaderStateDb { Ok(state) } + #[tracing::instrument(ret, level="debug")] async fn persist(&self) -> Result<(), Box> { let serialized_state = serde_yaml::to_string(&self.state)?; fs::write(self.filename.clone(), &serialized_state.as_bytes()).await?;