1 const {log} = require('proc-log')
2 const SYMBOL = Symbol('doc-log')
3
4 module.exports = Object.fromEntries(Object.entries(log).map(([k, v]) => [k, (...a) => v(SYMBOL, ...a)]))
5
6 /* istanbul ignore next */
7 module.exports.on = loglevel =>
8 process.on('log', (l, s, ...args) => {
9 // If loglevel is verbose, show everything. Otherwise only show things
10 // that are not verbose. The script only uses verbose and info, so this
11 // approach works for now.
12 if (s === SYMBOL && (loglevel === 'verbose' || l !== 'verbose')) {
13 console.error(l, ...args)
14 }
15 })