summaryrefslogtreecommitdiff
path: root/src/lib/log.js
blob: f548c49a5226d5c59bfe92e2e17d65255cbc73a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

{
  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}:${debugCount++} ${msg}`, ...rest);
  }

  function error(e, msg, ...rest) {
    console.error(`${PREFIX} ${msg}`, ...rest, e, e.message, e.stack);
  }
}