src: Unclutter logs by switching some info messages to debug

This commit is contained in:
2024-11-25 18:04:09 +00:00
parent e951fcdf83
commit 24d824f759
3 changed files with 8 additions and 8 deletions

View File

@ -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?;