Use error! instead of println! when panicking
This commit is contained in:
parent
b56fe855c3
commit
78d0a70221
1 changed files with 3 additions and 2 deletions
|
@ -2,18 +2,19 @@
|
|||
|
||||
use crate::sbi::shutdown;
|
||||
use core::panic::PanicInfo;
|
||||
use log::*;
|
||||
|
||||
#[panic_handler]
|
||||
fn panic(info: &PanicInfo) -> ! {
|
||||
if let Some(location) = info.location() {
|
||||
println!(
|
||||
error!(
|
||||
"[kernel] Panicked at {}:{} {}",
|
||||
location.file(),
|
||||
location.line(),
|
||||
info.message().unwrap()
|
||||
);
|
||||
} else {
|
||||
println!("[kernel] Panicked: {}", info.message().unwrap());
|
||||
error!("[kernel] Panicked: {}", info.message().unwrap());
|
||||
}
|
||||
shutdown(true)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue