only print with debug asserts.

This commit is contained in:
Lokathor 2023-01-01 00:34:14 -07:00
parent 38de4e8f5a
commit 416f8a089c
2 changed files with 3 additions and 1 deletions

View file

@ -5,8 +5,9 @@ use gba::prelude::*;
#[panic_handler] #[panic_handler]
fn panic_handler(info: &core::panic::PanicInfo) -> ! { fn panic_handler(info: &core::panic::PanicInfo) -> ! {
use core::fmt::Write; #[cfg(debug_assertions)]
if let Ok(mut logger) = MgbaBufferedLogger::try_new(MgbaMessageLevel::Fatal) { if let Ok(mut logger) = MgbaBufferedLogger::try_new(MgbaMessageLevel::Fatal) {
use core::fmt::Write;
writeln!(logger, "{info}").ok(); writeln!(logger, "{info}").ok();
} }
loop {} loop {}

View file

@ -6,6 +6,7 @@ use gba::prelude::*;
#[panic_handler] #[panic_handler]
fn panic_handler(info: &core::panic::PanicInfo) -> ! { fn panic_handler(info: &core::panic::PanicInfo) -> ! {
#[cfg(debug_assertions)]
if let Ok(mut logger) = MgbaBufferedLogger::try_new(MgbaMessageLevel::Fatal) { if let Ok(mut logger) = MgbaBufferedLogger::try_new(MgbaMessageLevel::Fatal) {
writeln!(logger, "{info}").ok(); writeln!(logger, "{info}").ok();
} }