fix services and add logs
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user