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

13 lines
550 B
Plaintext
Raw Normal View History

2024-09-18 03:38:49 -05:00
string := @use("string.hb")
2024-07-07 08:35:07 -05:00
LogMsg := packed struct {level: u8, string: ^u8, strlen: uint}
2024-09-17 12:08:19 -05:00
2024-10-25 10:37:38 -05:00
log := fn(level: u8, message: ^u8): void {
return @eca(3, 1, LogMsg.(level, message, @inline(string.length, message)), @sizeof(LogMsg))
2024-07-07 08:35:07 -05:00
}
2024-10-15 18:03:23 -05:00
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)