Open theromie opened 4 years ago
I'm also having this kind of scenario. Any updates on this one? Thanks!
It posts the Errors console, but does not use JSON. So it is always only posting to console.
app.use(
// This is not posting as JSON in production
expressWinston.errorLogger({
transports: [new winston.transports.Console()],
format: winston.format.combine(winston.format.json()),
})
)
I am using express-routes-mapper for routes and I have
expressWinston.logger({})
beforeapp.use('abc/xyz', mappedOpenRoutes);
andexpressWinston.errorLogger({})
afterapp.use('abc/xyz', mappedOpenRoutes);
butexpressWinston.logger({})
showing in console but errorLogger is not showing error into file. I have error likeReferenceError: email is not defined
but that is not being logged.app.use( expressWinston.errorLogger({ transports: [ new winston.transports.Console(), new DailyRotateFile({ filename: '%DATE%-error.log', datePattern: 'DD-MM-YYYY', maxSize: '20480', zippedArchive: true, }), ], format: winston.format.combine( winston.format.colorize(), winston.format.json() ), msg: '{{err.message}}', }) );