Use winston

This commit is contained in:
Dragon Fire
2018-10-07 21:12:07 -04:00
parent 82139dea1d
commit 8e4bcec80a
3 changed files with 16 additions and 6 deletions
+9
View File
@@ -1,5 +1,6 @@
const { CommandoClient } = require('discord.js-commando');
const { WebhookClient } = require('discord.js');
const winston = require('winston');
const PokemonStore = require('./PokemonStore');
const { XIAO_WEBHOOK_ID, XIAO_WEBHOOK_TOKEN } = process.env;
@@ -7,6 +8,14 @@ module.exports = class XiaoClient extends CommandoClient {
constructor(options) {
super(options);
this.logger = winston.createLogger({
transports: [new winston.transports.Console()],
format: winston.format.combine(
winston.format.colorize({ all: true }),
winston.format.timestamp({ format: 'MM/DD/YYYY HH:mm:ss' }),
winston.format.printf(log => `[${log.timestamp}] [${log.level.toUpperCase()}]: ${log.message}`)
)
});
this.webhook = new WebhookClient(XIAO_WEBHOOK_ID, XIAO_WEBHOOK_TOKEN, { disableEveryone: true });
this.pokemon = new PokemonStore();
}