ableos/sysdata/libraries/stn/src/log.hb

13 lines
551 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)