mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-08 18:26:48 +00:00
parent
2eab6dd743
commit
0897bd8e75
@ -40,7 +40,7 @@ macro_rules! define_unified_initializer_slice {
|
||||
static $name: [::unified_init::UnifiedInitializer] = [..];
|
||||
};
|
||||
() => {
|
||||
compile_kerror!(
|
||||
compile_error!(
|
||||
"define_unified_initializer_slice! requires at least one argument: slice_name"
|
||||
);
|
||||
};
|
||||
@ -54,7 +54,7 @@ macro_rules! define_public_unified_initializer_slice {
|
||||
pub static $name: [::unified_init::UnifiedInitializer] = [..];
|
||||
};
|
||||
() => {
|
||||
compile_kerror!(
|
||||
compile_error!(
|
||||
"define_unified_initializer_slice! requires at least one argument: slice_name"
|
||||
);
|
||||
};
|
||||
|
@ -871,9 +871,7 @@ macro_rules! define_filesystem_maker_slice {
|
||||
pub static $name: [FileSystemMaker] = [..];
|
||||
};
|
||||
() => {
|
||||
compile_kerror!(
|
||||
"define_filesystem_maker_slice! requires at least one argument: slice_name"
|
||||
);
|
||||
compile_error!("define_filesystem_maker_slice! requires at least one argument: slice_name");
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -90,10 +90,10 @@ impl Logger {
|
||||
|
||||
/// 内核自定义日志器
|
||||
///
|
||||
/// todo: 完善他的功能,并且逐步把kinfo等宏,迁移到这个logger上面来。
|
||||
struct CustomLogger;
|
||||
/// todo: https://github.com/DragonOS-Community/DragonOS/issues/762
|
||||
struct KernelLogger;
|
||||
|
||||
impl Log for CustomLogger {
|
||||
impl Log for KernelLogger {
|
||||
fn enabled(&self, _metadata: &log::Metadata) -> bool {
|
||||
// 这里可以自定义日志过滤规则
|
||||
true
|
||||
@ -112,10 +112,10 @@ impl Log for CustomLogger {
|
||||
}
|
||||
}
|
||||
|
||||
impl CustomLogger {
|
||||
impl KernelLogger {
|
||||
fn iodisplay(record: &log::Record) {
|
||||
match record.level() {
|
||||
Level::Debug | Level::Info => {
|
||||
Level::Debug | Level::Info | Level::Trace => {
|
||||
write!(PrintkWriter, "[ {} ] ", record.level(),)
|
||||
}
|
||||
Level::Error => {
|
||||
@ -124,9 +124,6 @@ impl CustomLogger {
|
||||
Level::Warn => {
|
||||
write!(PrintkWriter, "\x1B[1;33m[ WARN ] \x1B[0m",)
|
||||
}
|
||||
Level::Trace => {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
.unwrap();
|
||||
writeln!(
|
||||
@ -185,7 +182,7 @@ impl CustomLogger {
|
||||
}
|
||||
|
||||
pub fn early_init_logging() {
|
||||
log::set_logger(&CustomLogger).unwrap();
|
||||
log::set_logger(&KernelLogger).unwrap();
|
||||
log::set_max_level(log::LevelFilter::Debug);
|
||||
info!("Logging initialized");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user