Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Log runtime panic and oom with level error (#4193)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkchr authored Nov 24, 2019
1 parent eef00ea commit 605852e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions primitives/sr-io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -743,18 +743,16 @@ mod allocator_impl {
pub fn panic(info: &core::panic::PanicInfo) -> ! {
unsafe {
let message = rstd::alloc::format!("{}", info);
misc::print_utf8(message.as_bytes());
logging::log(LogLevel::Error, "runtime", message.as_bytes());
core::intrinsics::abort()
}
}

#[cfg(all(not(feature = "disable_oom"), not(feature = "std")))]
#[alloc_error_handler]
pub extern fn oom(_: core::alloc::Layout) -> ! {
static OOM_MSG: &str = "Runtime memory exhausted. Aborting";

unsafe {
misc::print_utf8(OOM_MSG.as_bytes());
logging::log(LogLevel::Error, "runtime", b"Runtime memory exhausted. Aborting");
core::intrinsics::abort();
}
}
Expand Down

0 comments on commit 605852e

Please sign in to comment.