forked from AbleOS/ableos
54 lines
600 B
Plaintext
54 lines
600 B
Plaintext
|
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 // !
|
||
|
]
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
enum LogResult {
|
||
|
Ok,
|
||
|
Error,
|
||
|
}
|
||
|
|
||
|
protocol Logger {
|
||
|
fn log(LogMessage) -> LogResult;
|
||
|
fn flush() -> LogResult;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|