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

15 lines
521 B
Plaintext
Raw Normal View History

2024-07-19 08:53:45 -05:00
string := @use("rel:string.hb")
2024-08-19 13:13:58 -05:00
buffer := @use("rel:buffer.hb")
2024-07-07 08:35:07 -05:00
log := fn(message: ^u8, level: u8): void {
message_length := @inline(string.length, message);
2024-07-19 08:53:45 -05:00
*(message + message_length) = level
2024-09-17 12:08:19 -05:00
return @eca(3, 1, message, message_length + 1)
2024-07-07 08:35:07 -05:00
}
2024-07-19 08:53:45 -05:00
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)
2024-07-20 12:54:58 -05:00
trace := fn(message: ^u8): void return log(message, 4)