more complex app runs as well..

This commit is contained in:
2024-04-08 17:29:18 +02:00
parent 18978f807f
commit ef58c54d27
10 changed files with 682 additions and 6 deletions

17
src/logger.rs Normal file
View File

@ -0,0 +1,17 @@
pub fn setup_logger() -> Result<(), fern::InitError> {
fern::Dispatch::new()
.format(|out, message, record| {
out.finish(format_args!(
"{}[{}][{}] {}",
chrono::Local::now().format("[%Y-%m-%d][%H:%M:%S]"),
std::thread::current().name().expect("unnamed_thread"),
record.level(),
message
))
})
.level(log::LevelFilter::Debug)
.chain(std::io::stdout())
.chain(fern::log_file("output.log")?)
.apply()?;
Ok(())
}