woomy/utils/logger.js

25 lines
917 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}}`,
error: `{{timestamp}} | ${'{{title}}'.red} | {{file}} | {{message}}`,
fatal: `{{timestamp}} | ${'{{title}}'.red.bold} | {{file}} | {{message}}`
}
],
dateformat: 'yyyy-mm-dd"T"HH:MM:ss',
methods: ['cmd', 'debug', 'info', 'ready', 'warn', 'error', 'fatal'],
filters: [colors.white]
})
module.exports = logger