chore: logger: show caller

This commit is contained in:
Paul Pan 2024-03-23 21:46:14 +08:00
parent c3d59bc9a4
commit 284e12348d
2 changed files with 6 additions and 4 deletions

View File

@ -9,7 +9,7 @@ use crate::plat::timer::{Timer, TimerOps};
use crate::plat::trap::{Trap, TrapOps};
#[thread_local]
static HART_ID: Cell<usize> = Cell::new(0);
pub static HART_ID: Cell<usize> = Cell::new(0);
#[no_mangle]
pub extern "C" fn rust_main(hart_id: usize, device_tree_addr: usize) -> ! {

View File

@ -31,11 +31,13 @@ impl Log for SimpleLogger {
RawConsole
.write_fmt(format_args!(
"{}[{}] {}{}\n",
color_prefix,
"{color_prefix}[{}] [{}] {}{color_reset}\n",
record.level(),
record
.module_path_static()
.or_else(|| record.module_path())
.unwrap_or("<n/a>"),
record.args(),
color_reset
))
.unwrap();
}