39 lines
692 B
Plaintext
39 lines
692 B
Plaintext
// DebugBox — conditional debug output aggregator (extracted)
|
|
box DebugBox {
|
|
enabled
|
|
birth() {
|
|
me.enabled = 0
|
|
return 0
|
|
}
|
|
set_enabled(v) {
|
|
me.enabled = v
|
|
return 0
|
|
}
|
|
log(msg) {
|
|
if me.enabled {
|
|
local c = new ConsoleBox()
|
|
c.println("[DEBUG] " + msg)
|
|
}
|
|
return 0
|
|
}
|
|
info(msg) {
|
|
if me.enabled {
|
|
local c = new ConsoleBox()
|
|
c.println("[INFO] " + msg)
|
|
}
|
|
return 0
|
|
}
|
|
error(msg) {
|
|
if me.enabled {
|
|
local c = new ConsoleBox()
|
|
c.println("[ERROR] " + msg)
|
|
}
|
|
return 0
|
|
}
|
|
}
|
|
|
|
// Include stub to satisfy current include lowering (expects a static box)
|
|
static box DebugStub {
|
|
main(args) { return 0 }
|
|
}
|