chore: logging: print time ticks in metadata

This commit is contained in:
Paul Pan 2024-05-20 16:06:41 +08:00
parent 001550b387
commit f005c8254b

View File

@ -1,6 +1,7 @@
use crate::entry::HART_ID;
use crate::plat::console::CONSOLE;
use crate::{entry::HART_ID, plat::timer::CURRENT_TICK};
use core::fmt::Write;
use core::sync::atomic::Ordering;
use log::{LevelFilter, Log, Metadata, Record};
struct SimpleLogger;
@ -28,9 +29,10 @@ impl Log for SimpleLogger {
CONSOLE
.lock()
.write_fmt(format_args!(
"{color_prefix}[{}][HART{}] {}{color_reset}\n",
"{color_prefix}[{}][HART{}][{}] {}{color_reset}\n",
record.level(),
HART_ID.get(),
CURRENT_TICK.load(Ordering::Acquire),
record.args(),
))
.unwrap();