]> git.bitcoin.ninja Git - dnsseed-rust/commitdiff
Print errs in red
authorMatt Corallo <git@bluematt.me>
Tue, 21 May 2019 01:18:45 +0000 (21:18 -0400)
committerMatt Corallo <git@bluematt.me>
Tue, 21 May 2019 01:18:45 +0000 (21:18 -0400)
src/printer.rs

index 4818d9af61ce4076dddc53de9a349e7cc3051c9f..37411274ce9181b0bec0196e5f7ae3dc64cd27dd 100644 (file)
@@ -149,9 +149,13 @@ impl Printer {
                }
        }
 
-       pub fn add_line(&self, line: String, _err: bool) {
+       pub fn add_line(&self, line: String, err: bool) {
                let mut stats = self.stats.lock().unwrap();
-               stats.lines.push_back(line);
+               if err {
+                       stats.lines.push_back("\x1b[31m".to_string() + &line + "\x1b[0m");
+               } else {
+                       stats.lines.push_back(line);
+               }
                if stats.lines.len() > 50 {
                        stats.lines.pop_front();
                }