Improve get child behavior

This commit is contained in:
Fabian Stamm
2020-04-11 17:39:20 +02:00
parent a1cd860688
commit 30f5e241ae
3 changed files with 96 additions and 28 deletions

View File

@ -49,5 +49,31 @@ Logging.warning("This should not be there 4");
Logging.error("This should be there 1");
Logging.errorMessage("This should be there 2");
const c1 = Logging.getChild("child-level-1");
c1.log("Hello from Child 1");
const c2 = c1.getChild("child-level-2");
c2.log("Hello from Child 2");
c2.addAdapter({
init: (obs) =>
obs.subscribe((msg) =>
console.log(
"Adapter adden on child level 2: ",
"---",
msg.name,
msg.text.raw
)
),
flush: () => undefined,
close: () => undefined,
});
c2.log("MSG from C2");
c1.log("MSG from C1");
Logging.log("MSG from root");
const timer = Logging.time("timer1", "Test Timer");
setTimeout(() => timer.end(), 1000);