24 lines
356 B
JavaScript
24 lines
356 B
JavaScript
|
// emits 'log' events on the process
|
||
|
const LEVELS = [
|
||
|
'notice',
|
||
|
'error',
|
||
|
'warn',
|
||
|
'info',
|
||
|
'verbose',
|
||
|
'http',
|
||
|
'silly',
|
||
|
'pause',
|
||
|
'resume',
|
||
|
]
|
||
|
|
||
|
const log = level => (...args) => process.emit('log', level, ...args)
|
||
|
|
||
|
const logger = {}
|
||
|
for (const level of LEVELS) {
|
||
|
logger[level] = log(level)
|
||
|
}
|
||
|
|
||
|
logger.LEVELS = LEVELS
|
||
|
|
||
|
module.exports = logger
|