1
0
Fork 0
forked from AbleOS/ableos

filtering out undesired logging

This commit is contained in:
able 2022-07-31 06:21:50 -05:00
parent be2b6dfa94
commit b1de5148b7
9 changed files with 56 additions and 39 deletions

View file

@ -6,8 +6,10 @@ user_processes = ["shell"]
enabled = true
level = "Trace"
log_to_serial = true
filter = ["ableos::vterm"]
[tests]
run_tests = false
run_demos = false
run_shader_tests = false
run_shader_tests = false

View file

@ -79,7 +79,7 @@ extern "x86-interrupt" fn double_fault_handler(
_error_code: u64,
) -> ! {
bsod(BSODSource::DoubleFault(&stack_frame));
panic!("EXCEPTION: DOUBLE FAULT\n{:#?}", stack_frame);
// panic!("EXCEPTION: DOUBLE FAULT\n{:#?}", stack_frame);
}
#[naked]
@ -123,7 +123,7 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStac
.add_byte(unsafe { Port::new(0x60).read() })
.map(|x| x.and_then(|ev| keyboard.process_keyevent(ev)))
{
trace!("{key:?}");
// trace!("{key:?}");
match key {
DecodedKey::Unicode(chr) => match chr {
// Backspace
@ -147,7 +147,7 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStac
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() {
set_pit_1(50);
set_pit_1(5000);
set_pit_2(1000);
set_pit_3(1000);
}

View file

@ -53,6 +53,7 @@ pub struct LoggingConfig {
pub enabled: bool,
pub log_to_serial: bool,
pub level: LogLevel,
pub filter: Vec<String>,
}
#[derive(Serialize, Debug, Deserialize)]
pub struct TestsConfig {

View file

@ -33,6 +33,7 @@ pub fn kernel_main() -> ! {
// /*
if KERNEL_CONF.logging.enabled {
log::set_max_level(KERNEL_CONF.log_level());
// println!("{:#?}", *KERNEL_CONF);
} else {
log::set_max_level(log::LevelFilter::Off);
}

View file

@ -39,7 +39,13 @@ impl log::Log for SimpleLogger {
);
*/
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",
};

View file

@ -38,14 +38,14 @@ impl core::fmt::Write for Stdout {
}
*/
trace!("printing");
// trace!("printing");
// x86_64::instructions::interrupts::without_interrupts(|| {
let mut term = TERM.lock();
term.set_dirty(true);
term.print(s.to_string());
drop(term);
// });
trace!("Finished printing");
// trace!("Finished printing");
Ok(())
}
#[cfg(target_arch = "riscv64")]

View file

@ -1,8 +1,11 @@
use crate::{
graphics::SCREEN_BUFFER,
relib::encoding::rle::{decode, encode},
vga_e::VGAE,
VgaBuffer,
};
use shadeable::pixel_format::new_rgba64;
use vga::writers::GraphicsWriter;
pub fn bruh() {
#[rustfmt::skip]
@ -10,27 +13,24 @@ pub fn bruh() {
let xyz_old = decode(&xyz_new);
trace!("encoded {:?}", xyz_new.len());
trace!("decoded {:?}", xyz_old.len());
let mut screen_lock = SCREEN_BUFFER.lock();
for y in 0..20 {
for x in 0..20 {
let screen_lock = VGAE.lock();
screen_lock.set_mode();
for y in 0..8 {
for x in 0..8 {
// trace!("");
// info!("x{} | y{}", x, y);
info!("x{} | y{}", x, y);
// Stops at 419
match xyz_old[y * 290 + x] {
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 => {
screen_lock.set_pixel(x, y, new_rgba64(128, 128, 128, 0));
screen_lock.set_pixel(x, y, vga::colors::Color16::DarkGrey);
}
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);

View file

@ -7,6 +7,7 @@ use crate::channels::{Channel, ChannelPermission};
use crate::devices::pci;
use crate::filesystem::FILE_SYSTEM;
use crate::handle::Handle;
use crate::image::mono_bitmap::bruh;
use crate::ipc::IPC;
use crate::rhai_shell::shell;
use crate::rhai_shell::KEYBUFF;
@ -70,6 +71,7 @@ impl Path {
/// Experimental scratchpad for testing.
pub fn scratchpad() {
// bruh();
real_shell();
}

View file

@ -46,7 +46,7 @@ impl Term {
// trace!("IMPOSSIBLE BACKSPACE");
return;
}
// trace!("BACKSPACE");
trace!("BACKSPACE");
self.x -= 1;
self.term[TERM_MINUS_ONE_LINE + (self.x as usize)] = '\0';
}
@ -81,27 +81,32 @@ impl Term {
let mode = VGAE.lock();
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(
(mouse_coord.0 as isize + 0, mouse_coord.1 as isize + 0),
(mouse_coord.0 as isize + 10, mouse_coord.1 as isize + 10),
CURSOR_COLOR,
);
mode.draw_line(
(mouse_coord.0 as isize + 0, mouse_coord.1 as isize + 0),
(mouse_coord.0 as isize + 5, mouse_coord.1 as isize + 0),
CURSOR_COLOR,
);
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 + 5),
CURSOR_COLOR,
);
mode.draw_line(
(mouse_coord.0 as isize + 0, mouse_coord.1 as isize + 0),
(mouse_coord.0 as isize + 10, mouse_coord.1 as isize + 10),
CURSOR_COLOR,
);
mode.draw_line(
(mouse_coord.0 as isize + 0, mouse_coord.1 as isize + 0),
(mouse_coord.0 as isize + 5, mouse_coord.1 as isize + 0),
CURSOR_COLOR,
);
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 + 5),
CURSOR_COLOR,
);
}
*/
let mut x = 0;
let mut y = 0;