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}; use crate::plat::trap::{Trap, TrapOps};
#[thread_local] #[thread_local]
static HART_ID: Cell<usize> = Cell::new(0); pub static HART_ID: Cell<usize> = Cell::new(0);
#[no_mangle] #[no_mangle]
pub extern "C" fn rust_main(hart_id: usize, device_tree_addr: usize) -> ! { pub extern "C" fn rust_main(hart_id: usize, device_tree_addr: usize) -> ! {

View File

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