Electrum Trace
The Trace
class provides static tracing functions:
log()
,info()
,warn()
anderror()
which are by default forwarding toconsole
.dir()
which is by default forwarding toconsole
too.
The user of Trace
can reconfigure the tracing:
intercept(name, func)
→ intercepts the named call and callsfunc
before calling the default. Multiple calls tointercept
can be donc with the samename
. The calls will be dispatched first to the last added funciton.reset()
→ resets to the default forwarding.clear()
→ clears all forwarding, making calls tolog()
, etc. equivalent to a no-op.clear(name)
→ clears the named call; this replaces it with a no-op.clear(name1, name2, ...)
→ clears multiple named calls.
How to use
Install with:
npm install electrum-trace
Import with:
;
and use like this:
Trace; // With interceptionTrace;Trace; // Resetting interceptionTrace;Trace; // Suppressing messagesTraceclear 'log';Trace;