mirror of
https://github.com/kristoferssolo/traxor.git
synced 2025-10-21 20:10:35 +00:00
19 lines
526 B
Rust
19 lines
526 B
Rust
use color_eyre::Result;
|
|
use tracing_appender::rolling;
|
|
use tracing_subscriber::{self, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
|
|
|
|
pub fn setup_logger() -> Result<()> {
|
|
std::fs::create_dir_all(".logs")?;
|
|
let logfile = rolling::daily(".log", "traxor.log");
|
|
let log_layer = tracing_subscriber::fmt::layer()
|
|
.with_writer(logfile)
|
|
.with_ansi(false);
|
|
|
|
tracing_subscriber::registry()
|
|
.with(log_layer)
|
|
.with(EnvFilter::from_default_env())
|
|
.init();
|
|
|
|
Ok(())
|
|
}
|