use crate::prelude::{_print_log, _serial_write};
use core::fmt;
use x86_64::instructions::interrupts;

#[macro_export]
macro_rules! debugln {
	() => ($crate::print_log!("\n"));
	($($arg:tt)*) => ($crate::debug!("{}\n", format_args!($($arg)*)));
}

#[macro_export]
macro_rules! debug {
	($($arg:tt)*) => ($crate::prelude::_debug(format_args!($($arg)*)));
}

pub fn _debug(args: fmt::Arguments) {
    interrupts::without_interrupts(|| {
        _print_log(args);
        _serial_write(args);
    });
}
