opensmtpd-filter-dkimout/src/logs.rs
2023-03-23 14:57:24 +01:00

17 lines
387 B
Rust

use env_logger::{Builder, Env, Target};
use std::io::Write;
pub fn init_log_system() {
let env = Env::new().filter_or(crate::LOG_LEVEL_ENV_VAR, "warn");
let mut builder = Builder::from_env(env);
builder.format(|buf, record| {
writeln!(
buf,
"{}: {}",
record.level().to_string().to_lowercase(),
record.args()
)
});
builder.target(Target::Stderr);
builder.init();
}