galactic-bot/Logger.js

25 lines
605 B
JavaScript
Raw Normal View History

const winston = require('winston');
const moment = require('moment');
2020-04-08 16:27:34 +02:00
2020-04-09 16:30:52 +02:00
class Logger {
2020-04-08 16:27:34 +02:00
2020-04-09 16:30:52 +02:00
constructor(manager) {
this.manager = manager;
this.logger = winston.createLogger({
transports: [
new winston.transports.Console(),
2020-04-11 10:10:52 +02:00
new winston.transports.File({ filename: `logs/${this.date}.log` }),
new winston.transports.File({ filename: `logs/${this.date}-error.log`, level: 'error' })
]
});
2020-04-09 16:30:52 +02:00
}
2020-04-08 16:27:34 +02:00
get date() {
2020-04-11 10:10:52 +02:00
return moment().format("MM-DD-YYYY-hh:mm:ss");
}
2020-04-08 16:27:34 +02:00
}
module.exports = Logger;