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