Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errorLogger is not working #240

Open
theromie opened this issue May 14, 2020 · 2 comments
Open

errorLogger is not working #240

theromie opened this issue May 14, 2020 · 2 comments

Comments

@theromie
Copy link

I am using express-routes-mapper for routes and I have expressWinston.logger({}) before app.use('abc/xyz', mappedOpenRoutes); and expressWinston.errorLogger({}) after app.use('abc/xyz', mappedOpenRoutes); but expressWinston.logger({}) showing in console but errorLogger is not showing error into file.
I have error like ReferenceError: 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}}', }) );

@MelodicCrypter
Copy link

I'm also having this kind of scenario. Any updates on this one? Thanks!

@crucialfelix
Copy link

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()),
   })
 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants