rust-nex/rnex-core/src/common.rs
Maple Nebel 98649b224d
All checks were successful
Build and Test / sonic-transformed (push) Successful in 1m57s
Build and Test / wii-sports-club (push) Successful in 2m28s
Build and Test / minecraft-wiiu (push) Successful in 2m58s
Build and Test / friends (push) Successful in 3m29s
Build and Test / fast-racing-neo (push) Successful in 3m50s
Build and Test / splatoon (push) Successful in 4m30s
Build and Test / super-mario-maker (push) Successful in 5m34s
Build and Test / splatoon-testfire (push) Successful in 5m52s
Build and Test / puyopuyo (push) Successful in 6m23s
Build and Test / wii-u-chat (push) Successful in 6m54s
Build and Test / mario-tennis (push) Successful in 7m9s
startup log
2026-05-29 10:53:58 +02:00

38 lines
1.2 KiB
Rust

use chrono::{Local, SecondsFormat};
use log::LevelFilter;
use simplelog::{ColorChoice, CombinedLogger, Config, TermLogger, TerminalMode, WriteLogger};
use std::fs;
use std::fs::File;
pub fn setup() {
println!("setting up logger and dotenv");
CombinedLogger::init(vec![
TermLogger::new(
LevelFilter::Info,
Config::default(),
TerminalMode::Mixed,
ColorChoice::Auto,
),
WriteLogger::new(LevelFilter::max(), Config::default(), {
fs::create_dir_all("log").unwrap();
let date = Local::now().to_rfc3339_opts(SecondsFormat::Secs, false);
// this fixes windows being windows
let date = date.replace(":", "-");
let filename = format!("{}.log", date);
if cfg!(windows) {
File::create(format!("log\\{}", filename)).unwrap()
} else {
File::create(format!("log/{}", filename)).unwrap()
}
}),
])
.unwrap();
/*ctrlc::set_handler(||{
FORCE_EXIT.call_once_force(|_|{
println!("attempting exit");
});
}).unwrap();*/
dotenv::dotenv().ok();
}