25 lines
605 B
JavaScript
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; |