1
0
Fork 0
forked from koniifer/ableos

minor cleanup

This commit is contained in:
Able 2021-12-30 03:32:32 -06:00
parent 353d759e94
commit 07f8df04d1
3 changed files with 45 additions and 10 deletions

View file

@ -116,7 +116,6 @@ use lazy_static::lazy_static;
use spin::Mutex; use spin::Mutex;
use volatile::Volatile; use volatile::Volatile;
use crate::print;
#[macro_export] #[macro_export]
macro_rules! kprint { macro_rules! kprint {
($($arg:tt)*) => ($crate::arch::drivers::vga::_kprint(format_args!($($arg)*))); ($($arg:tt)*) => ($crate::arch::drivers::vga::_kprint(format_args!($($arg)*)));

View file

@ -91,6 +91,7 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStac
print!(" "); print!(" ");
WRITER.lock().backspace(); WRITER.lock().backspace();
} }
_ => { _ => {
print!("{}", char::try_from(character).unwrap()); print!("{}", char::try_from(character).unwrap());
} }
@ -101,7 +102,11 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStac
DecodedKey { DecodedKey {
kind: DecodedKeyKind::RawKey, kind: DecodedKeyKind::RawKey,
value: key, value: key,
} => print!("{:?}", KeyCode::from(key)), } => {
if KeyCode::from(key) != KeyCode::AltLeft {
print!("{:?}", KeyCode::from(key))
}
}
} }
} }
} }

View file

@ -32,35 +32,66 @@ pub struct ANSISerialLogger;
impl Log for ANSISerialLogger { impl Log for ANSISerialLogger {
fn debug(val: &str) { fn debug(val: &str) {
if LOG_STATE.lock().log_to_serial { if LOG_STATE.lock().log_to_serial {
serial_println!("[{}Debug{}] {}", Fg::Blue, Reset, val); serial_println!(
"[{}Debug{}][{}FakeTempTime{}] {}",
Fg::Blue,
Reset,
Fg::Green,
Reset,
val
);
} }
if LOG_STATE.lock().log_to_screen { if LOG_STATE.lock().log_to_screen {
println!("[$BLUE$Debug$RESET$] {}", val); println!("[$BLUE$Debug$RESET$][$GREEN$FakeTempTime$RESET$] {}", val);
} }
} }
fn error(val: &str) { fn error(val: &str) {
if LOG_STATE.lock().log_to_serial { if LOG_STATE.lock().log_to_serial {
serial_println!("[{}Error{}] {}", Fg::Red, Reset, val); serial_println!(
"[{}Error{}][{}FakeTempTime{}] {}",
Fg::Red,
Reset,
Fg::Green,
Reset,
val
);
} }
if LOG_STATE.lock().log_to_screen { if LOG_STATE.lock().log_to_screen {
println!("[$RED$Error$RESET$] {}", val); println!("[$RED$Error$RESET$][$GREEN$FakeTempTime$RESET$] {}", val);
} }
} }
fn info(val: &str) { fn info(val: &str) {
if LOG_STATE.lock().log_to_serial { if LOG_STATE.lock().log_to_serial {
serial_println!("[{}Info{}] {}", Fg::LightWhite, Reset, val); serial_println!(
"[{}Info{} ][{}FakeTempTime{}] {}",
Fg::LightWhite,
Reset,
Fg::Green,
Reset,
val
);
} }
if LOG_STATE.lock().log_to_screen { if LOG_STATE.lock().log_to_screen {
println!("[$LIGHTGRAY$Info$RESET$] {}", val); println!(
"[$LIGHTGRAY$Info$RESET$ ][$GREEN$FakeTempTime$RESET$] {}",
val
);
} }
} }
fn trace(val: &str) { fn trace(val: &str) {
if LOG_STATE.lock().log_to_serial { if LOG_STATE.lock().log_to_serial {
serial_println!("[{}Trace{}] {}", Fg::Yellow, Reset, val); serial_println!(
"[{}Trace{}][{}FakeTempTime{}] {}",
Fg::Yellow,
Reset,
Fg::Green,
Reset,
val
);
} }
if LOG_STATE.lock().log_to_screen { if LOG_STATE.lock().log_to_screen {
println!("[$YELLOW$Trace$RESET$] {}", val); println!("[$YELLOW$Trace$RESET$][$GREEN$FakeTempTime$RESET$] {}", val);
} }
} }
} }