forked from koniifer/ableos
filtering out undesired logging
This commit is contained in:
parent
be2b6dfa94
commit
b1de5148b7
|
@ -6,8 +6,10 @@ user_processes = ["shell"]
|
||||||
enabled = true
|
enabled = true
|
||||||
level = "Trace"
|
level = "Trace"
|
||||||
log_to_serial = true
|
log_to_serial = true
|
||||||
|
filter = ["ableos::vterm"]
|
||||||
|
|
||||||
|
|
||||||
[tests]
|
[tests]
|
||||||
run_tests = false
|
run_tests = false
|
||||||
run_demos = false
|
run_demos = false
|
||||||
run_shader_tests = false
|
run_shader_tests = false
|
||||||
|
|
|
@ -79,7 +79,7 @@ extern "x86-interrupt" fn double_fault_handler(
|
||||||
_error_code: u64,
|
_error_code: u64,
|
||||||
) -> ! {
|
) -> ! {
|
||||||
bsod(BSODSource::DoubleFault(&stack_frame));
|
bsod(BSODSource::DoubleFault(&stack_frame));
|
||||||
panic!("EXCEPTION: DOUBLE FAULT\n{:#?}", stack_frame);
|
// panic!("EXCEPTION: DOUBLE FAULT\n{:#?}", stack_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[naked]
|
#[naked]
|
||||||
|
@ -123,7 +123,7 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStac
|
||||||
.add_byte(unsafe { Port::new(0x60).read() })
|
.add_byte(unsafe { Port::new(0x60).read() })
|
||||||
.map(|x| x.and_then(|ev| keyboard.process_keyevent(ev)))
|
.map(|x| x.and_then(|ev| keyboard.process_keyevent(ev)))
|
||||||
{
|
{
|
||||||
trace!("{key:?}");
|
// trace!("{key:?}");
|
||||||
match key {
|
match key {
|
||||||
DecodedKey::Unicode(chr) => match chr {
|
DecodedKey::Unicode(chr) => match chr {
|
||||||
// Backspace
|
// Backspace
|
||||||
|
@ -147,7 +147,7 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStac
|
||||||
warn!("ArrowKeys are unsupported currently");
|
warn!("ArrowKeys are unsupported currently");
|
||||||
}
|
}
|
||||||
|
|
||||||
kc => print!("{kc:?}"),
|
kc => trace!("Unprintable key: {kc:?}"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ pub fn set_pit_3(freq: u32) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reset_pit_for_cpu() {
|
pub fn reset_pit_for_cpu() {
|
||||||
set_pit_1(50);
|
set_pit_1(5000);
|
||||||
set_pit_2(1000);
|
set_pit_2(1000);
|
||||||
set_pit_3(1000);
|
set_pit_3(1000);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ pub struct LoggingConfig {
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
pub log_to_serial: bool,
|
pub log_to_serial: bool,
|
||||||
pub level: LogLevel,
|
pub level: LogLevel,
|
||||||
|
pub filter: Vec<String>,
|
||||||
}
|
}
|
||||||
#[derive(Serialize, Debug, Deserialize)]
|
#[derive(Serialize, Debug, Deserialize)]
|
||||||
pub struct TestsConfig {
|
pub struct TestsConfig {
|
||||||
|
|
|
@ -33,6 +33,7 @@ pub fn kernel_main() -> ! {
|
||||||
// /*
|
// /*
|
||||||
if KERNEL_CONF.logging.enabled {
|
if KERNEL_CONF.logging.enabled {
|
||||||
log::set_max_level(KERNEL_CONF.log_level());
|
log::set_max_level(KERNEL_CONF.log_level());
|
||||||
|
// println!("{:#?}", *KERNEL_CONF);
|
||||||
} else {
|
} else {
|
||||||
log::set_max_level(log::LevelFilter::Off);
|
log::set_max_level(log::LevelFilter::Off);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,13 @@ impl log::Log for SimpleLogger {
|
||||||
);
|
);
|
||||||
*/
|
*/
|
||||||
let mod_path = match record.module_path() {
|
let mod_path = match record.module_path() {
|
||||||
Some(p) => p,
|
Some(p) => {
|
||||||
|
if KERNEL_CONF.logging.filter.contains(&p.to_string()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
p
|
||||||
|
}
|
||||||
None => "unknown",
|
None => "unknown",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -38,14 +38,14 @@ impl core::fmt::Write for Stdout {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
trace!("printing");
|
// trace!("printing");
|
||||||
// x86_64::instructions::interrupts::without_interrupts(|| {
|
// x86_64::instructions::interrupts::without_interrupts(|| {
|
||||||
let mut term = TERM.lock();
|
let mut term = TERM.lock();
|
||||||
term.set_dirty(true);
|
term.set_dirty(true);
|
||||||
term.print(s.to_string());
|
term.print(s.to_string());
|
||||||
drop(term);
|
drop(term);
|
||||||
// });
|
// });
|
||||||
trace!("Finished printing");
|
// trace!("Finished printing");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
#[cfg(target_arch = "riscv64")]
|
#[cfg(target_arch = "riscv64")]
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
graphics::SCREEN_BUFFER,
|
graphics::SCREEN_BUFFER,
|
||||||
relib::encoding::rle::{decode, encode},
|
relib::encoding::rle::{decode, encode},
|
||||||
|
vga_e::VGAE,
|
||||||
|
VgaBuffer,
|
||||||
};
|
};
|
||||||
use shadeable::pixel_format::new_rgba64;
|
use shadeable::pixel_format::new_rgba64;
|
||||||
|
use vga::writers::GraphicsWriter;
|
||||||
|
|
||||||
pub fn bruh() {
|
pub fn bruh() {
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
|
@ -10,27 +13,24 @@ pub fn bruh() {
|
||||||
|
|
||||||
let xyz_old = decode(&xyz_new);
|
let xyz_old = decode(&xyz_new);
|
||||||
|
|
||||||
trace!("encoded {:?}", xyz_new.len());
|
let screen_lock = VGAE.lock();
|
||||||
trace!("decoded {:?}", xyz_old.len());
|
screen_lock.set_mode();
|
||||||
|
for y in 0..8 {
|
||||||
let mut screen_lock = SCREEN_BUFFER.lock();
|
for x in 0..8 {
|
||||||
|
|
||||||
for y in 0..20 {
|
|
||||||
for x in 0..20 {
|
|
||||||
// trace!("");
|
// trace!("");
|
||||||
// info!("x{} | y{}", x, y);
|
info!("x{} | y{}", x, y);
|
||||||
|
|
||||||
// Stops at 419
|
// Stops at 419
|
||||||
match xyz_old[y * 290 + x] {
|
match xyz_old[y * 290 + x] {
|
||||||
221..=255 => {
|
221..=255 => {
|
||||||
screen_lock.set_pixel(x, y, new_rgba64(255, 255, 255, 0));
|
screen_lock.set_pixel(x, y, vga::colors::Color16::Red);
|
||||||
}
|
}
|
||||||
170..=220 => {
|
170..=220 => {
|
||||||
screen_lock.set_pixel(x, y, new_rgba64(128, 128, 128, 0));
|
screen_lock.set_pixel(x, y, vga::colors::Color16::DarkGrey);
|
||||||
}
|
}
|
||||||
|
|
||||||
100..=169 => {
|
100..=169 => {
|
||||||
screen_lock.set_pixel(x, y, new_rgba64(56, 56, 56, 0));
|
screen_lock.set_pixel(x, y, vga::colors::Color16::LightGrey);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
// VGAE.lock().set_pixel(x, y, Color16::Red);
|
// VGAE.lock().set_pixel(x, y, Color16::Red);
|
||||||
|
|
|
@ -7,6 +7,7 @@ use crate::channels::{Channel, ChannelPermission};
|
||||||
use crate::devices::pci;
|
use crate::devices::pci;
|
||||||
use crate::filesystem::FILE_SYSTEM;
|
use crate::filesystem::FILE_SYSTEM;
|
||||||
use crate::handle::Handle;
|
use crate::handle::Handle;
|
||||||
|
use crate::image::mono_bitmap::bruh;
|
||||||
use crate::ipc::IPC;
|
use crate::ipc::IPC;
|
||||||
use crate::rhai_shell::shell;
|
use crate::rhai_shell::shell;
|
||||||
use crate::rhai_shell::KEYBUFF;
|
use crate::rhai_shell::KEYBUFF;
|
||||||
|
@ -70,6 +71,7 @@ impl Path {
|
||||||
|
|
||||||
/// Experimental scratchpad for testing.
|
/// Experimental scratchpad for testing.
|
||||||
pub fn scratchpad() {
|
pub fn scratchpad() {
|
||||||
|
// bruh();
|
||||||
real_shell();
|
real_shell();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ impl Term {
|
||||||
// trace!("IMPOSSIBLE BACKSPACE");
|
// trace!("IMPOSSIBLE BACKSPACE");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// trace!("BACKSPACE");
|
trace!("BACKSPACE");
|
||||||
self.x -= 1;
|
self.x -= 1;
|
||||||
self.term[TERM_MINUS_ONE_LINE + (self.x as usize)] = '\0';
|
self.term[TERM_MINUS_ONE_LINE + (self.x as usize)] = '\0';
|
||||||
}
|
}
|
||||||
|
@ -81,27 +81,32 @@ impl Term {
|
||||||
let mode = VGAE.lock();
|
let mode = VGAE.lock();
|
||||||
mode.clear_screen(Color16::Black);
|
mode.clear_screen(Color16::Black);
|
||||||
|
|
||||||
let mouse_coord = x86_64::instructions::interrupts::without_interrupts(|| {
|
/*
|
||||||
let cursor = MOUSE.lock();
|
let mouse = false;
|
||||||
|
if mouse {
|
||||||
|
let mouse_coord = x86_64::instructions::interrupts::without_interrupts(|| {
|
||||||
|
let cursor = MOUSE.lock();
|
||||||
|
|
||||||
(cursor.get_x() as usize, cursor.get_y() as usize)
|
(cursor.get_x() as usize, cursor.get_y() as usize)
|
||||||
});
|
});
|
||||||
|
|
||||||
mode.draw_line(
|
mode.draw_line(
|
||||||
(mouse_coord.0 as isize + 0, mouse_coord.1 as isize + 0),
|
(mouse_coord.0 as isize + 0, mouse_coord.1 as isize + 0),
|
||||||
(mouse_coord.0 as isize + 10, mouse_coord.1 as isize + 10),
|
(mouse_coord.0 as isize + 10, mouse_coord.1 as isize + 10),
|
||||||
CURSOR_COLOR,
|
CURSOR_COLOR,
|
||||||
);
|
);
|
||||||
mode.draw_line(
|
mode.draw_line(
|
||||||
(mouse_coord.0 as isize + 0, mouse_coord.1 as isize + 0),
|
(mouse_coord.0 as isize + 0, mouse_coord.1 as isize + 0),
|
||||||
(mouse_coord.0 as isize + 5, mouse_coord.1 as isize + 0),
|
(mouse_coord.0 as isize + 5, mouse_coord.1 as isize + 0),
|
||||||
CURSOR_COLOR,
|
CURSOR_COLOR,
|
||||||
);
|
);
|
||||||
mode.draw_line(
|
mode.draw_line(
|
||||||
(mouse_coord.0 as isize + 0, mouse_coord.1 as isize + 0),
|
(mouse_coord.0 as isize + 0, mouse_coord.1 as isize + 0),
|
||||||
(mouse_coord.0 as isize + 0, mouse_coord.1 as isize + 5),
|
(mouse_coord.0 as isize + 0, mouse_coord.1 as isize + 5),
|
||||||
CURSOR_COLOR,
|
CURSOR_COLOR,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
let mut x = 0;
|
let mut x = 0;
|
||||||
let mut y = 0;
|
let mut y = 0;
|
||||||
|
|
Loading…
Reference in a new issue