(cont) botlog module

This commit is contained in:
ModulatingForce 2024-02-13 10:11:49 -05:00
commit 51d5db3f4e
5 changed files with 411 additions and 78 deletions

View file

@ -6,7 +6,7 @@ use std::process::Output;
use crate::core::botinstance::ArcBox;
use crate::core::botinstance::BotInstance;
use crate::core::botinstance::{self,BotInstance};
use casual_logger::Extension;
use tokio::sync::RwLock;
use std::sync::Arc;
@ -23,7 +23,8 @@ pub async fn main() {
let bot = BotInstance::init().await;
Log::debug("Checking bot actions");
// Log::debug("Checking bot actions");
botinstance::botlog::debug("Checking bot actions", Some("main()".to_string()), None);
let a = Arc::clone(&bot.botmodules.botactions);
let a = a.read().await;
// let a = *a;
@ -33,15 +34,18 @@ pub async fn main() {
match act {
crate::core::botmodules::BotAction::C(b) => {
// println!("bot actiions: {}",b.command)
Log::info(&format!("bot actions: {}",b.command));
// Log::info(&format!("bot actions: {}",b.command));
botinstance::botlog::info(&format!("bot actions: {}",b.command), Some("main()".to_string()), None);
},
crate::core::botmodules::BotAction::L(l) => {
// println!("bot actiions: {}",l.name)
Log::info(&format!("bot actions: {}",l.name));
// Log::info(&format!("bot actions: {}",l.name));
botinstance::botlog::info(&format!("bot actions: {}",l.name), Some("main()".to_string()), None);
},
_ => {
// println!("Not a valid match??")
Log::info("Not a valid match??");
// Log::info("Not a valid match??");
botinstance::botlog::info("Not a valid match??", Some("main()".to_string()), None);
},
}
@ -49,7 +53,9 @@ pub async fn main() {
};
// println!("Starting runner..");
Log::notice("Starting Bot Runner");
// Log::notice("Starting Bot Runner");
botinstance::botlog::notice("Starting Bot Runner", Some("main()".to_string()), None);
println!("Starting Bot Runner");
Log::flush();
@ -57,6 +63,8 @@ pub async fn main() {
// println!("ERROR : EXIT Game loop");
// let msg = Log::fatal("ERROR : EXIT Game loop");
panic!("{}",Log::fatal("ERROR : EXIT Game loop"));
// panic!("{}",Log::fatal("ERROR : EXIT Game loop"));
let a = botinstance::botlog::fatal("ERROR : EXIT Game loop", Some("main()".to_string()), None);
panic!("{}",a);
}