zenyx-engine-telemetry/engine/src/main.rs

49 lines
1.1 KiB
Rust
Raw Normal View History

2024-12-01 20:50:11 -05:00
use anyhow::Result;
use clap::Parser;
use log::{info, warn, LevelFilter};
2024-12-01 16:02:06 -05:00
pub mod core;
pub mod utils;
2024-12-01 16:02:06 -05:00
use utils::{logger::LOGGER, splash::print_splash};
#[derive(Parser)]
struct Cli {
#[arg(long, short, help = "Enable logging output")]
log: bool,
}
2024-12-01 16:02:06 -05:00
#[tokio::main]
2024-12-01 20:50:11 -05:00
async fn main() -> Result<()> {
2024-12-03 01:12:33 -05:00
let t = zephyr::add(0, 2);
println!("{}", t);
let cli = Cli::parse();
log::set_logger(&*LOGGER).unwrap();
log::set_max_level(LevelFilter::Debug);
2024-12-01 16:02:06 -05:00
print_splash();
if cli.log {
info!("Initializing Engine with logging to stdout enabled");
core::init_renderer()?;
} else {
LOGGER.write_to_stdout();
info!("Initializing Engine with logging to stdout disabled");
info!("Writing all logs to file z.log");
LOGGER.write_to_file("z.log");
info!("Logging back to file z.log");
let shell_thread = tokio::task::spawn(async {
2024-12-02 15:43:39 -05:00
core::repl::repl::handle_repl().await
});
core::init_renderer()?;
2024-12-02 15:43:39 -05:00
shell_thread.await??; // LOL - Caz
}
2024-12-01 16:02:06 -05:00
Ok(())
}