DiscordTickets/src/logger.js
Isaac 2e9217f30d Fix and improve broken and bad code.
Improve command handler, fixed message logging, fixes potential prefix problem, other small changes
2021-04-01 19:33:53 +01:00

61 lines
1.4 KiB
JavaScript

const { path } = require('./utils/fs');
const config = require('../user/config');
const Logger = require('leekslazylogger-fastify');
module.exports = new Logger({
name: 'Discord Tickets by eartharoid',
debug: config.debug,
logToFile: config.logs.enabled,
splitFile: config.logs.split,
directory: path('./logs/'),
keepFor: config.logs.keep_for,
timestamp: 'YYYY-MM-DD HH:mm:ss',
levels: {
_logger: {
format: '&f&!7{timestamp}&r [LOGGER] {text}'
},
basic: {
format: '&f&!7{timestamp} {text}'
},
console: {
format: '&f&!7{timestamp} [INFO] {text}'
},
info: {
format: '&f&!7{timestamp}&r &3[INFO] &b{text}'
},
success: {
format: '&f&!7{timestamp}&r &2[SUCCESS] &a{text}'
},
debug: {
format: '&f&!7{timestamp}&r &1[DEBUG] &9{text}'
},
notice: {
format: '&f&!7{timestamp}&r &0&!6[NOTICE] {text}'
},
warn: {
format: '&f&!7{timestamp}&r &6[WARN] &e{text}'
},
error: {
format: '&f&!7{timestamp}&r &4[ERROR] &c{text}'
},
commands: {
type: 'info',
format: '&f&!7{timestamp}&r &3[INFO] &d(COMMANDS)&r {text}'
},
plugins: {
type: 'info',
format: '&f&!7{timestamp}&r &3[INFO] &d(PLUGINS)&r {text}'
},
tickets: {
type: 'info',
format: '&f&!7{timestamp}&r &3[INFO] &d(TICKETS)&r {text}'
},
http: {
type: 'info',
format: '&f&!7{timestamp}&r &3[INFO] &d(HTTP)&r {text}'
},
ws: {
type: 'info',
format: '&f&!7{timestamp}&r &3[INFO] &d(WS)&r {text}'
}
}
});