add: console log support
This commit is contained in:
parent
0edc584330
commit
4c9e93295c
|
@ -31,3 +31,38 @@ macro_rules! println {
|
||||||
$crate::console::print(format_args!(concat!($fmt, "\n") $(, $($arg)+)?));
|
$crate::console::print(format_args!(concat!($fmt, "\n") $(, $($arg)+)?));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! log_error {
|
||||||
|
($fmt: literal $(, $($arg: tt)+)?) => {
|
||||||
|
$crate::console::print(format_args!(concat!("\x1b[31m" ,concat!($fmt, "\x1b[0m\n")) $(, $($arg)+)?));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! log_warning {
|
||||||
|
($fmt: literal $(, $($arg: tt)+)?) => {
|
||||||
|
$crate::console::print(format_args!(concat!("\x1b[93m" ,concat!($fmt, "\x1b[0m\n")) $(, $($arg)+)?));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! log_information {
|
||||||
|
($fmt: literal $(, $($arg: tt)+)?) => {
|
||||||
|
$crate::console::print(format_args!(concat!("\x1b[34m" ,concat!($fmt, "\x1b[0m\n")) $(, $($arg)+)?));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! log_debug {
|
||||||
|
($fmt: literal $(, $($arg: tt)+)?) => {
|
||||||
|
$crate::console::print(format_args!(concat!("\x1b[32m" ,concat!($fmt, "\x1b[0m\n")) $(, $($arg)+)?));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! log_trace {
|
||||||
|
($fmt: literal $(, $($arg: tt)+)?) => {
|
||||||
|
$crate::console::print(format_args!(concat!("\x1b[90m" ,concat!($fmt, "\x1b[0m\n")) $(, $($arg)+)?));
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,7 +13,11 @@ global_asm!(include_str!("entry.asm"));
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
fn rust_main() -> ! {
|
fn rust_main() -> ! {
|
||||||
clear_bss();
|
clear_bss();
|
||||||
println!("Hello, rCore!");
|
log_error!("Hello, rCore!");
|
||||||
|
log_warning!("Hello, rCore!");
|
||||||
|
log_information!("Hello, rCore!");
|
||||||
|
log_debug!("Hello, rCore!");
|
||||||
|
log_trace!("Hello, rCore!");
|
||||||
sbi::shutdown(false);
|
sbi::shutdown(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user