diff options
author | hackademix | 2019-10-21 23:18:18 +0200 |
---|---|---|
committer | hackademix | 2019-10-25 23:19:48 +0100 |
commit | 384b4b742390ea7830a9291a57808a443e8ca31e (patch) | |
tree | d3884e74b2634e51cd7ef29f7d7d6c67e602824d /src/lib | |
parent | c1b3922de121ca3ad47c503d76183b76f6ef9404 (diff) | |
download | noscript-384b4b742390ea7830a9291a57808a443e8ca31e.tar.gz noscript-384b4b742390ea7830a9291a57808a443e8ca31e.tar.xz noscript-384b4b742390ea7830a9291a57808a443e8ca31e.zip |
Progressive count of debug messages to better trace asynchronous execution.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/log.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/log.js b/src/lib/log.js index 0f12698..f548c49 100644 --- a/src/lib/log.js +++ b/src/lib/log.js @@ -1,13 +1,16 @@ { let PREFIX = `[${browser.runtime.getManifest().name}]`; + let debugCount = 0; function log(msg, ...rest) { console.log(`${PREFIX} ${msg}`, ...rest); } + function debug(msg, ...rest) { - console.debug(`${PREFIX} ${msg}`, ...rest); + console.debug(`${PREFIX}:${debugCount++} ${msg}`, ...rest); } + function error(e, msg, ...rest) { console.error(`${PREFIX} ${msg}`, ...rest, e, e.message, e.stack); } |