patch minor logging bug
This commit is contained in:
parent
84f86488c7
commit
086cc4aef0
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
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)
|
|
@ -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
|
||||
}
|
Loading…
Reference in a new issue