Sha256: e40f4247ab9ddc3ab6c59046e6e77c49fe669606a5ea72cc51f526449553d2ea
Contents?: true
Size: 1003 Bytes
Versions: 230
Compression:
Stored size: 1003 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
230 entries across 230 versions & 1 rubygems