From 9e8296b696224415f1a0c4c5251fd52afe144b2b Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Mon, 9 Jan 2023 15:38:06 +0100 Subject: [PATCH] log: align log message timestamp With this change, all log messages will have the same width for the timestamp. The number of ms is rounded to 6 decimal places. Signed-off-by: Philipp Schuster --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index e0b59a961..51a34dac0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -89,7 +89,7 @@ impl log::Log for Logger { if record.file().is_some() && record.line().is_some() { writeln!( *(*(self.output.lock().unwrap())), - "cloud-hypervisor: {:?}: <{}> {}:{}:{} -- {}", + "cloud-hypervisor: {:.6?}: <{}> {}:{}:{} -- {}", duration, std::thread::current().name().unwrap_or("anonymous"), record.level(), @@ -100,7 +100,7 @@ impl log::Log for Logger { } else { writeln!( *(*(self.output.lock().unwrap())), - "cloud-hypervisor: {:?}: <{}> {}:{} -- {}", + "cloud-hypervisor: {:.6?}: <{}> {}:{} -- {}", duration, std::thread::current().name().unwrap_or("anonymous"), record.level(),