mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-10 12:16:48 +00:00
new: rust下的kdebug kinfo kwarn kBUG kerror宏 (#86)
* new: rust下的kdebug kinfo kwarn kBUG kerror宏
This commit is contained in:
parent
c6174797dc
commit
0bfe94f46b
@ -12,8 +12,7 @@ typedef uint32_t uid_t;
|
||||
typedef uint32_t gid_t;
|
||||
typedef long long ssize_t;
|
||||
|
||||
typedef int __pid_t;
|
||||
#define pid_t int64_t
|
||||
typedef int64_t pid_t;
|
||||
typedef __SIZE_TYPE__ size_t;
|
||||
|
||||
typedef char *caddr_t;
|
||||
|
@ -43,3 +43,44 @@ macro_rules! printk_color {
|
||||
$crate::libs::printk::PrintkWriter.__write_string_color($FRcolor, $BKcolor, alloc::fmt::format(format_args!($($arg)*)).as_str())
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! kdebug {
|
||||
($($arg:tt)*) => {
|
||||
$crate::libs::printk::PrintkWriter.__write_string((alloc::fmt::format(format_args!("[ DEBUG ] ({}:{})\t", file!(), line!()))+
|
||||
alloc::fmt::format(format_args!($($arg)*)).as_str() + "\n").as_str())
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! kinfo {
|
||||
($($arg:tt)*) => {
|
||||
$crate::libs::printk::PrintkWriter.__write_string((alloc::string::String::from("[ INFO ] ")+ alloc::fmt::format(format_args!($($arg)*)).as_str() + "\n").as_str())
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! kwarn {
|
||||
($($arg:tt)*) => {
|
||||
$crate::libs::printk::PrintkWriter.__write_string_color($crate::include::DragonOS::printk::COLOR_YELLOW, $crate::include::DragonOS::printk::COLOR_BLACK, "[ WARN ] ");
|
||||
$crate::libs::printk::PrintkWriter.__write_string((alloc::fmt::format(format_args!($($arg)*)) + "\n").as_str())
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! kerror {
|
||||
($($arg:tt)*) => {
|
||||
$crate::libs::printk::PrintkWriter.__write_string_color($crate::include::DragonOS::printk::COLOR_RED, $crate::include::DragonOS::printk::COLOR_BLACK, "[ ERROR ] ");
|
||||
$crate::libs::printk::PrintkWriter.__write_string((alloc::fmt::format(format_args!("({}:{})\t", file!(), line!())) +
|
||||
alloc::fmt::format(format_args!($($arg)*)).as_str() + "\n").as_str())
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! kBUG {
|
||||
($($arg:tt)*) => {
|
||||
$crate::libs::printk::PrintkWriter.__write_string_color($crate::include::DragonOS::printk::COLOR_RED, $crate::include::DragonOS::printk::COLOR_BLACK, "[ BUG ] ");
|
||||
$crate::libs::printk::PrintkWriter.__write_string((alloc::fmt::format(format_args!("({}:{})\t", file!(), line!())) +
|
||||
alloc::fmt::format(format_args!($($arg)*)).as_str() + "\n").as_str())
|
||||
}
|
||||
}
|
@ -12,8 +12,7 @@ typedef uint32_t uid_t;
|
||||
typedef uint32_t gid_t;
|
||||
typedef long long ssize_t;
|
||||
|
||||
typedef int __pid_t;
|
||||
#define pid_t __pid_t
|
||||
typedef int64_t pid_t;
|
||||
typedef __SIZE_TYPE__ size_t;
|
||||
|
||||
typedef char *caddr_t;
|
||||
|
Loading…
x
Reference in New Issue
Block a user