2020-04-09 23:08:28 +02:00
|
|
|
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;
|
2020-04-09 23:08:28 +02:00
|
|
|
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
|
|
|
|
2020-04-09 23:08:28 +02:00
|
|
|
get date() {
|
|
|
|
return moment().format("MM/DD/YYYY hh:mm:ss");
|
|
|
|
}
|
|
|
|
|
2020-04-08 16:27:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Logger;
|