ableos/sysdata/testing.idl

64 lines
994 B
Plaintext
Raw Normal View History

2024-02-15 14:21:00 -06:00
type String {
length uint32,
data [u8; length],
}
// needs three bits to store this
@exhaustive
enum LogLevel {
Error = 0,
Warn = 1,
Info = 2,
Debug = 3,
Trace = 4,
}
type LogMessage {
log_level = LogLevel,
log_message = String,
}
// This is displayed as bits sent over the wire
[
010 // INFO
00000000_00000000_00000000_00000011 // Length of the string
01001000 // H
01101001 // i
00100001 // !
]
2024-03-11 09:48:56 -05:00
// This is displayed as bytes in memory
[
0x3 // INFO
0xD // Length of the string
0x48
0x69
0x21
]
2024-02-15 14:21:00 -06:00
enum LogResult {
Ok,
Error,
}
2024-03-11 09:48:56 -05:00
@exhaustive
2024-02-15 14:21:00 -06:00
protocol Logger {
2024-03-11 09:48:56 -05:00
2024-02-15 14:21:00 -06:00
fn log(LogMessage) -> LogResult;
2024-03-11 09:48:56 -05:00
fn error(String) -> LogResult;
fn warn(String) -> LogResult;
fn info(String) -> LogResult;
fn debug(String) -> LogResult;
fn trace(String) -> LogResult;
2024-02-15 14:21:00 -06:00
fn flush() -> LogResult;
}
2024-03-11 09:48:56 -05:00
TODO argue about time being added after the fact in the logger or inplace by the loggee