fixed output rule warn #336

This commit is contained in:
DustInDark
2021-12-22 18:29:17 +09:00
parent 98a6ca8adc
commit bf0d3b12f2

View File

@@ -83,11 +83,25 @@ impl Detection {
err_msgs_result.err().iter().for_each(|err_msgs| {
let errmsg_body =
format!("Failed to parse rule file. (FilePath : {})", rule.rulepath);
AlertMessage::warn(&mut std::io::stdout().lock(), &errmsg_body).ok();
if configs::CONFIG.read().unwrap().args.is_present("verbose") {
AlertMessage::warn(&mut std::io::stdout().lock(), &errmsg_body).ok();
err_msgs.iter().for_each(|err_msg| {
AlertMessage::warn(&mut std::io::stdout().lock(), err_msg).ok();
});
err_msgs.iter().for_each(|err_msg| {
AlertMessage::warn(&mut std::io::stdout().lock(), err_msg).ok();
});
}
if !*QUIET_ERRORS_FLAG {
ERROR_LOG_STACK
.lock()
.unwrap()
.push(format!("[WARN] {}", errmsg_body));
err_msgs.iter().for_each(|err_msg| {
ERROR_LOG_STACK
.lock()
.unwrap()
.push(format!("[WARN] {}", err_msg));
});
}
parseerror_count += 1;
println!(""); // 一行開けるためのprintln
});