diff --git a/kernel/src/holeybytes/kernel_services/logging_service.rs b/kernel/src/holeybytes/kernel_services/logging_service.rs index a0b461f91..48a38b940 100644 --- a/kernel/src/holeybytes/kernel_services/logging_service.rs +++ b/kernel/src/holeybytes/kernel_services/logging_service.rs @@ -14,7 +14,7 @@ pub fn log_msg_handler(_vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(), let file_name = "None"; 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) => { use log::Level::*; let log_level = match log_level { diff --git a/sysdata/libraries/stn/src/log.hb b/sysdata/libraries/stn/src/log.hb index 14639df82..72c68ebdf 100644 --- a/sysdata/libraries/stn/src/log.hb +++ b/sysdata/libraries/stn/src/log.hb @@ -1,15 +1,14 @@ 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 + message_length) = level + *(message + message_length) = Level return @eca(3, 1, message, message_length + 1) } -error := fn(message: ^u8): void return log(message, 0) -warn := fn(message: ^u8): void return log(message, 1) -info := fn(message: ^u8): void return log(message, 2) -debug := fn(message: ^u8): void return log(message, 3) -trace := fn(message: ^u8): void return log(message, 4) \ No newline at end of file +error := fn(message: ^u8): void return @inline(log, 0, message) +warn := fn(message: ^u8): void return @inline(log, 1, message) +info := fn(message: ^u8): void return @inline(log, 2, message) +debug := fn(message: ^u8): void return @inline(log, 3, message) +trace := fn(message: ^u8): void return @inline(log, 4, message) \ No newline at end of file diff --git a/sysdata/programs/tests/src/main.hb b/sysdata/programs/tests/src/main.hb index be45842ab..e89eafb57 100644 --- a/sysdata/programs/tests/src/main.hb +++ b/sysdata/programs/tests/src/main.hb @@ -9,5 +9,11 @@ service_search := fn(): void { main := fn(): int { //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 } \ No newline at end of file