From c4e734610c40879406e747c784d28209356197b5 Mon Sep 17 00:00:00 2001 From: Yifan Wu Date: Tue, 28 Mar 2023 23:42:48 +0800 Subject: [PATCH] Use error! instead of println! when panicking --- os/src/lang_items.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/os/src/lang_items.rs b/os/src/lang_items.rs index 68d736ec..021f16fa 100644 --- a/os/src/lang_items.rs +++ b/os/src/lang_items.rs @@ -2,18 +2,19 @@ use crate::sbi::shutdown; use crate::task::current_kstack_top; use core::arch::asm; 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()); } unsafe { backtrace();