From ab2117796dc8702c1572b703ebd69c51d2926d0b Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 12 Oct 2023 21:15:49 +0000 Subject: [PATCH] Make test log lines somewhat more eye-scannable When running tests, our log output should be reasonably readable by developers, but currently it repeats the module twice (via the module and file name), and then starts the log line at a variable location. Instead, we only print the module and then align the start of the log lines so that the output is much more scannable. --- lightning/src/util/test_utils.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index bd66e4ca..f89d5a99 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -969,8 +969,10 @@ impl Logger for TestLogger { fn log(&self, record: &Record) { *self.lines.lock().unwrap().entry((record.module_path.to_string(), format!("{}", record.args))).or_insert(0) += 1; if record.level >= self.level { - #[cfg(all(not(ldk_bench), feature = "std"))] - println!("{:<5} {} [{} : {}, {}] {}", record.level.to_string(), self.id, record.module_path, record.file, record.line, record.args); + #[cfg(all(not(ldk_bench), feature = "std"))] { + let pfx = format!("{} {} [{}:{}]", self.id, record.level.to_string(), record.module_path, record.line); + println!("{:<55}{}", pfx, record.args); + } } } } -- 2.30.2