From 61e67520d15bbf473816927abe831d4ebadac3c5 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 24 Apr 2020 12:06:03 +0800 Subject: [PATCH] libsupport_zynq: better logging format (from ARTIQ) --- libsupport_zynq/src/logger.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libsupport_zynq/src/logger.rs b/libsupport_zynq/src/logger.rs index 534897e..b663b48 100644 --- a/libsupport_zynq/src/logger.rs +++ b/libsupport_zynq/src/logger.rs @@ -16,8 +16,14 @@ impl log::Log for Logger { } fn log(&self, record: &log::Record) { - if true || self.enabled(record.metadata()) { - println!("{} - {}", record.level(), record.args()); + if self.enabled(record.metadata()) { + // TODO: let timestamp = clock::get_us(); + let timestamp = 0; + let seconds = timestamp / 1_000_000; + let micros = timestamp % 1_000_000; + + println!("[{:6}.{:06}s] {:>5}({}): {}", + seconds, micros, record.level(), record.target(), record.args()); } } fn flush(&self) {