From 7d5f10e6cbdf533c60b20ea22787955cc495dae0 Mon Sep 17 00:00:00 2001 From: DustInDark Date: Mon, 20 Dec 2021 11:47:49 +0900 Subject: [PATCH] changed rule read warn output from std to errorlog write #301 --- src/yaml.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/yaml.rs b/src/yaml.rs index 4411afb2..afe9c5c1 100644 --- a/src/yaml.rs +++ b/src/yaml.rs @@ -72,7 +72,12 @@ impl ParseYaml { let read_content = self.read_file(path); if read_content.is_err() { AlertMessage::warn( - &mut std::io::stdout().lock(), + &mut BufWriter::new( + OpenOptions::new() + .append(true) + .open(ERROR_LOG_PATH.to_string()) + .unwrap(), + ), format!( "fail to read file: {}\n{} ", entry.path().display(), @@ -87,7 +92,12 @@ impl ParseYaml { let yaml_contents = YamlLoader::load_from_str(&read_content.unwrap()); if yaml_contents.is_err() { AlertMessage::warn( - &mut std::io::stdout().lock(), + &mut BufWriter::new( + OpenOptions::new() + .append(true) + .open(ERROR_LOG_PATH.to_string()) + .unwrap(), + ), format!( "Failed to parse yml: {}\n{} ", entry.path().display(),