From 962609c1dc6a57a6373a3e99bcc588e8e24f079a Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 29 Dec 2020 01:21:51 +0000 Subject: [PATCH] format log better Signed-off-by: Ian Jackson --- wdriver.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/wdriver.rs b/wdriver.rs index dc987219..2da630d4 100644 --- a/wdriver.rs +++ b/wdriver.rs @@ -24,6 +24,7 @@ pub use void::Void; pub use t4::WebDriverCommands; pub use std::env; +pub use std::fmt; pub use std::fs; pub use std::collections::hash_map::HashMap; pub use std::convert::TryInto; @@ -708,12 +709,18 @@ fn fetch_log(driver: &T4d, name: &str) { { #[derive(Deserialize)] struct LogEnt(String, Vec); + impl fmt::Display for LogEnt { + #[throws(fmt::Error)] + fn fmt(&self, f: &mut fmt::Formatter) { + write!(f, "{}:", self.0)?; + for a in &self.1 { write!(f, " {}", a)?; } + } + } let ent: LogEnt = serde_json::from_value(ent.clone()) .context("parse log entry")?; - eprint!("JS {} {}:", name, &ent.0); - for a in ent.1 { eprint!(" {}", a); } - eprintln!(""); + + debug!("JS {} {}", name, &ent); } Ok::<_,AE>(()) })() -- 2.30.2