galactic-bot/Logger.js
2020-04-11 02:10:52 -06:00

25 lines
605 B
JavaScript

const winston = require('winston');
const moment = require('moment');
class Logger {
constructor(manager) {
this.manager = manager;
this.logger = winston.createLogger({
transports: [
new winston.transports.Console(),
new winston.transports.File({ filename: `logs/${this.date}.log` }),
new winston.transports.File({ filename: `logs/${this.date}-error.log`, level: 'error' })
]
});
}
get date() {
return moment().format("MM-DD-YYYY-hh:mm:ss");
}
}
module.exports = Logger;