Notorious Party Muppets

    electrum-trace

    1.1.2 • Public • Published

    Electrum Trace

    The Trace class provides static tracing functions:

    • log(), info(), warn() and error() which are by default forwarding to console.
    • dir() which is by default forwarding to console too.

    The user of Trace can reconfigure the tracing:

    • intercept(name, func) → intercepts the named call and calls func before calling the default. Multiple calls to intercept can be donc with the same name. The calls will be dispatched first to the last added funciton.
    • reset() → resets to the default forwarding.
    • clear() → clears all forwarding, making calls to log(), 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:

    import Trace from 'electrum-trace';

    and use like this:

    Trace.log ('Hello, world');
     
    // With interception
    Trace.intercept ('log', x => { /* do something */ });
    Trace.log ('Hello, world');
     
    // Resetting interception
    Trace.reset ();
    Trace.log ('Hello, world');
     
    // Suppressing messages
    Trace.clear ('log');
    Trace.log ('Hello, world');

    Keywords

    none

    Install

    npm i electrum-trace

    DownloadsWeekly Downloads

    1

    Version

    1.1.2

    License

    MIT

    Last publish

    Collaborators

    • yvessaz
    • samlebarbare
    • catia
    • nocturnight
    • schroeterm
    • pierre.arnaud