galactic-bot/Logger.js

25 lines
597 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(),
new winston.transports.File({ filename: `${Date.now()}.log` }),
new winston.transports.File({ filename: `${Date.now()}-error.log`, level: 'error' })
]
});
2020-04-09 16:30:52 +02:00
}
2020-04-08 16:27:34 +02:00
get date() {
return moment().format("MM/DD/YYYY hh:mm:ss");
}
2020-04-08 16:27:34 +02:00
}
module.exports = Logger;