Adapt the logs to OpenSMTPD
This commit is contained in:
parent
dd955fcb44
commit
4210a91d59
2 changed files with 10 additions and 4 deletions
13
src/logs.rs
13
src/logs.rs
|
@ -1,10 +1,17 @@
|
|||
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")
|
||||
.write_style_or(crate::LOG_STYLE_ENV_VAR, "never");
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ use stdin_reader::StdinReader;
|
|||
|
||||
const DEFAULT_BUFF_SIZE: usize = 1024;
|
||||
const LOG_LEVEL_ENV_VAR: &str = "OPENSMTPD_FILTER_DKIMOUT_LOG_LEVEL";
|
||||
const LOG_STYLE_ENV_VAR: &str = "OPENSMTPD_FILTER_DKIMOUT_LOG_STYLE";
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! display_bytes {
|
||||
|
|
Loading…
Reference in a new issue