1
0
Fork 0
forked from AbleOS/ableos

patch minor logging bug

This commit is contained in:
koniifer 2024-10-16 00:03:23 +01:00
parent 84f86488c7
commit 086cc4aef0
3 changed files with 14 additions and 9 deletions

View file

@ -14,7 +14,7 @@ pub fn log_msg_handler(_vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(),
let file_name = "None"; let file_name = "None";
let line_number = 0; let line_number = 0;
match core::str::from_utf8(&msg_vec[..msg_vec.len()]) { match core::str::from_utf8(&msg_vec[..msg_vec.len() - 1]) {
Ok(strr) => { Ok(strr) => {
use log::Level::*; use log::Level::*;
let log_level = match log_level { let log_level = match log_level {

View file

@ -1,15 +1,14 @@
string := @use("string.hb") string := @use("string.hb")
buffer := @use("buffer.hb")
log := fn(message: ^u8, level: u8): void { log := fn($Level: u8, message: ^u8): void {
message_length := @inline(string.length, message); message_length := @inline(string.length, message);
*(message + message_length) = level *(message + message_length) = Level
return @eca(3, 1, message, message_length + 1) return @eca(3, 1, message, message_length + 1)
} }
error := fn(message: ^u8): void return log(message, 0) error := fn(message: ^u8): void return @inline(log, 0, message)
warn := fn(message: ^u8): void return log(message, 1) warn := fn(message: ^u8): void return @inline(log, 1, message)
info := fn(message: ^u8): void return log(message, 2) info := fn(message: ^u8): void return @inline(log, 2, message)
debug := fn(message: ^u8): void return log(message, 3) debug := fn(message: ^u8): void return @inline(log, 3, message)
trace := fn(message: ^u8): void return log(message, 4) trace := fn(message: ^u8): void return @inline(log, 4, message)

View file

@ -9,5 +9,11 @@ service_search := fn(): void {
main := fn(): int { main := fn(): int {
//service_search() //service_search()
buf := "\0\0\0\0"
x := 0
loop if x == 255 break else {
log.info(string.display_int(x, buf))
x += 1
}
return 0 return 0
} }