mirror of
https://github.com/panpaul/tiny_os
synced 2024-09-20 09:45:19 +08:00
chore: logging: print time ticks in metadata
This commit is contained in:
parent
001550b387
commit
f005c8254b
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user