fix services and add logs

This commit is contained in:
2026-03-24 13:40:30 +00:00
parent 2592b1a1d1
commit e486c1980e
11 changed files with 328 additions and 26 deletions
@@ -0,0 +1,48 @@
// Injeção pelo hardware
declare contract LogHost host {
fn write(level: int, msg: string): void;
fn writeTag(level: int, tag: int, msg: string): void;
}
// exposicao do modulo, com sugar sintatico, nada injetado aqui
pub service Log {
fn trace(msg: string): void {
LogHost.write(0, msg);
}
fn trace(tag: int, msg: string): void {
LogHost.writeTag(0, tag, msg);
}
fn debug(msg: string): void {
LogHost.write(1, msg);
}
fn debug(tag: int, msg: string): void {
LogHost.writeTag(1, tag, msg);
}
fn info(msg: string): void {
LogHost.write(2, msg);
}
fn info(tag: int, msg: string): void {
LogHost.writeTag(2, tag, msg);
}
fn warn(msg: string): void {
LogHost.write(3, msg);
}
fn warn(tag: int, msg: string): void {
LogHost.writeTag(3, tag, msg);
}
fn err(msg: string): void {
LogHost.write(4, msg);
}
fn err(tag: int, msg: string): void {
LogHost.writeTag(4, tag, msg);
}
}