woomy/utils/logger.js

24 lines
827 B
JavaScript
Raw Normal View History

'use strict'
2020-04-18 14:14:11 +00:00
const { colorConsole } = require('tracer')
const colors = require('colors')
const logger = colorConsole({
format: [
'{{timestamp}} | {{title}} | {{file}} | {{message}}',
{
debug: `{{timestamp}} | ${'{{title}}'.magenta} | {{file}} | {{message}}`,
cmd: `{{timestamp}} | ${'{{title}}'.white} | {{file}} | {{message}}`,
info: `{{timestamp}} | ${'{{title}}'.cyan} | {{file}} | {{message}}`,
ready: `{{timestamp}} | ${'{{title}}'.green} | {{file}} | {{message}}`,
warn: `{{timestamp}} | ${'{{title}}'.yellow} | {{file}} | {{message}}`,
2020-04-18 14:23:50 +00:00
error: `{{timestamp}} | ${'{{title}}'.red} | {{file}} | {{message}}`
2020-04-18 14:14:11 +00:00
}
],
dateformat: 'yyyy-mm-dd"T"HH:MM:ss',
2020-04-18 14:23:50 +00:00
methods: ['cmd', 'debug', 'info', 'ready', 'warn', 'error'],
2020-04-18 14:14:11 +00:00
filters: [colors.white]
})
module.exports = logger