personal_website/src/logger.rs

22 lines
437 B
Rust
Raw Normal View History

2024-03-28 01:12:42 +00:00
use log::LevelFilter;
2024-03-23 20:03:16 +00:00
2024-03-23 20:28:03 +00:00
use crate::cli::CliArgs;
2024-03-23 20:03:16 +00:00
2024-03-23 20:28:03 +00:00
pub fn init_logger(cli: &CliArgs) {
let level = if cli.debug {
LevelFilter::Debug
} else {
LevelFilter::Info
};
2024-03-23 20:03:16 +00:00
2024-03-28 01:12:42 +00:00
env_logger::builder()
.filter_level(LevelFilter::Off)
.parse_env("RUST_LOG")
.filter_module("website", level)
.init();
// env_logger::Builder::from_env(Env::default().default_filter_or("warn")).init();
2024-03-23 20:03:16 +00:00
}