mirror of
https://github.com/jcreek/denBot.git
synced 2026-07-13 02:43:46 +00:00
feat(*): Add winston for logging
This commit is contained in:
@@ -1,7 +1,32 @@
|
||||
const Discord = require('discord.js');
|
||||
const winston = require('winston');
|
||||
const config = require('./config.json');
|
||||
const client = new Discord.Client();
|
||||
|
||||
const logger = winston.createLogger({
|
||||
level: 'info',
|
||||
format: winston.format.json(),
|
||||
defaultMeta: { service: 'user-service' },
|
||||
transports: [
|
||||
//
|
||||
// - Write all logs with level `error` and below to `error.log`
|
||||
// - Write all logs with level `info` and below to `combined.log`
|
||||
//
|
||||
new winston.transports.File({ filename: 'error.log', level: 'error' }),
|
||||
new winston.transports.File({ filename: 'combined.log' }),
|
||||
],
|
||||
});
|
||||
|
||||
//
|
||||
// If we're not in production then log to the `console` with the format:
|
||||
// `${info.level}: ${info.message} JSON.stringify({ ...rest }) `
|
||||
//
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
logger.add(new winston.transports.Console({
|
||||
format: winston.format.simple(),
|
||||
}));
|
||||
}
|
||||
|
||||
const queueTitle = '===== QUEUE =====';
|
||||
|
||||
let playerQueue = [];
|
||||
|
||||
Reference in New Issue
Block a user