src: Unclutter logs by switching some info messages to debug
This commit is contained in:
parent
e951fcdf83
commit
9f9526ea9c
@ -56,7 +56,7 @@ pub async fn fetch_and_parse_feed(uri: &str) -> Result<Feed, Box<dyn Error>> {
|
||||
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<Feed, Box<dyn Error>> {
|
||||
None => String::from("Untitled")
|
||||
};
|
||||
|
||||
info!("Got feed with title \"{}\"", feed_title);
|
||||
debug!("Got feed with title \"{}\"", feed_title);
|
||||
|
||||
Ok(Feed {
|
||||
uri: String::from(uri),
|
||||
|
@ -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<DateTime<Utc>> {
|
||||
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<dyn Error>> {
|
||||
let serialized_state = serde_yaml::to_string(&self.state)?;
|
||||
fs::write(self.filename.clone(), &serialized_state.as_bytes()).await?;
|
||||
|
Loading…
Reference in New Issue
Block a user