Debug Logging

This commit is contained in:
Neshura 2023-07-31 19:22:28 +02:00
parent 355040b9a0
commit d31f291e26
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C

View file

@ -99,20 +99,25 @@ impl Bot {
#[warn(unused_results)] #[warn(unused_results)]
pub(crate) fn run_once(&mut self, mut prev_time: NaiveTime) -> bool { pub(crate) fn run_once(&mut self, mut prev_time: NaiveTime) -> bool {
println!("{:#<1$}", "", 30);
self.start_time = Utc::now(); self.start_time = Utc::now();
if self.start_time.time() - prev_time > chrono::Duration::seconds(6) { // Prod should use hours, add command line switch later and read duration from config if self.start_time.time() - prev_time > chrono::Duration::seconds(6) { // Prod should use hours, add command line switch later and read duration from config
println!("Reloading Config");
prev_time = self.start_time.time(); prev_time = self.start_time.time();
self.config.load(); self.config.load();
if !self.community_ids.load(&self.auth, &self.config.instance) {return false}; // Return early if community id's cannot be loaded if !self.community_ids.load(&self.auth, &self.config.instance) {return false}; // Return early if community id's cannot be loaded
println!("Done!");
} }
// Start the polling process // Start the polling process
// Get all feed URLs (use cache) // Get all feed URLs (use cache)
println!("Checking Feeds");
let post_queue: Vec<CreatePost> = match self.config.check_feeds(&mut self.post_history, &self.community_ids, &self.auth) { let post_queue: Vec<CreatePost> = match self.config.check_feeds(&mut self.post_history, &self.community_ids, &self.auth) {
Ok(data) => data, Ok(data) => data,
Err(_) => return false Err(_) => return false
}; };
println!("Done!");
post_queue.iter().for_each(|post| { post_queue.iter().for_each(|post| {
println!("Posting: {}", post.name); println!("Posting: {}", post.name);