Skip to content

Commit ab21177

Browse files
committed
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.
1 parent 2c51080 commit ab21177

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lightning/src/util/test_utils.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -969,8 +969,10 @@ impl Logger for TestLogger {
969969
fn log(&self, record: &Record) {
970970
*self.lines.lock().unwrap().entry((record.module_path.to_string(), format!("{}", record.args))).or_insert(0) += 1;
971971
if record.level >= self.level {
972-
#[cfg(all(not(ldk_bench), feature = "std"))]
973-
println!("{:<5} {} [{} : {}, {}] {}", record.level.to_string(), self.id, record.module_path, record.file, record.line, record.args);
972+
#[cfg(all(not(ldk_bench), feature = "std"))] {
973+
let pfx = format!("{} {} [{}:{}]", self.id, record.level.to_string(), record.module_path, record.line);
974+
println!("{:<55}{}", pfx, record.args);
975+
}
974976
}
975977
}
976978
}

0 commit comments

Comments
 (0)