Sha256: 79c471c659afacb79e52764e12cdd08d546ce831fbc9169e7988bc8e5bc14439
Contents?: true
Size: 1002 Bytes
Versions: 259
Compression:
Stored size: 1002 Bytes
Contents
/** * Usage: logg(someObject, 'label') * * This development-grade logger can be used instead of console.log() with some advantages: * * It encourages consistent labeling of logs. By labeling each log line, you can have dozens of log lines * written per action, and still know which log line comes from where. * The recommended label is the component name, or function name. * * If the label is present, the logged object is placed in the window, allowing you to inspect it in the console. The * label becomes the name of the object (stripped to [0-9a-zA-Z\-_] chars). If you're logging a function, you can execute it. * If you log more than one thing, they can interact, allowing you to validate control flow. * * the logger can be turned off by making this function simply return. **/ function logg (a, b="", c=null) { c = "string" === typeof c ? c : b.replace(/\W/g, ""); if (c.length > 0) { window[c] = a; } console.log(`+++ ${b}:`, a); // eslint-disable-line no-console };
Version data entries
259 entries across 259 versions & 3 rubygems