woomy/utils/logger.js

26 lines
920 B
JavaScript
Raw Permalink Normal View History

2020-04-20 04:52:50 +00:00
// Copyright 2020 Emily J. / mudkipscience and contributors. Subject to the AGPLv3 license.
2020-04-20 03:02:10 +00:00
'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