ableos/sysdata/libraries/stn/src/log.hb
2024-10-25 16:37:38 +01:00

13 lines
550 B
Plaintext

string := @use("string.hb")
LogMsg := packed struct {level: u8, string: ^u8, strlen: uint}
log := fn(level: u8, message: ^u8): void {
return @eca(3, 1, LogMsg.(level, message, @inline(string.length, message)), @sizeof(LogMsg))
}
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)