const { Console } = require('console'); // get the Console class
const fs = require('fs'); // get fs module for creating write streams
// make a new logger
const eventsLogger = new Console({
stdout: fs.createWriteStream('logs/eventsLog.txt', {
flags: 'a+',
}), // a write stream (normal log outputs)
stderr: fs.createWriteStream('logs/eventsErrorLog.txt', {
flags: 'a+',
}), // a write stream (error outputs)
});
eventsLogger.log("Normal logged message");
eventsLogger.error('Error in connecting to database');