From 384b4b742390ea7830a9291a57808a443e8ca31e Mon Sep 17 00:00:00 2001 From: hackademix Date: Mon, 21 Oct 2019 23:18:18 +0200 Subject: Progressive count of debug messages to better trace asynchronous execution. --- src/lib/log.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/lib/log.js') 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); } -- cgit v1.2.3