mirror of
https://github.com/rcore-os/rCore-Tutorial-v3.git
synced 2024-11-22 17:36:25 +04:00
Use error! instead of println! when panicking
This commit is contained in:
parent
e0c0ec8764
commit
70f8e7bafa
@ -1,17 +1,18 @@
|
||||
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…
Reference in New Issue
Block a user