express-winston icon indicating copy to clipboard operation
express-winston copied to clipboard

Omit stack + trace on errorLogger

Open weeco opened this issue 8 years ago • 4 comments

I am trying to omit the stack and trace fields from my error log messages, however the documentation is a bit confusing.

What I've tried, which would still output stack + trace in the error log:

app.use(expressWinston.errorLogger({
  winstonInstance,
  showStack: false,
  showTrace: false,
}))

Quoted from your readme:

    // Optionally you can include your custom error handler after the logging.
    app.use(express.errorLogger({
      dumpExceptions: true,
      showStack: true
    }));

I couldn't find the "showStack" property documented anywhere so I simply tried to use showTrace: false too. However nor the showTrace or showStack property seem to affect anything. How can I achieve that the error messages don't contain the stack + trace anymore?

weeco avatar Oct 03 '17 14:10 weeco

I don't see dumpExceptions in the repo anywhere either with a GitHub search, and TS complains about it.

codingthat avatar Mar 05 '21 09:03 codingthat

@codingthat I can't remember at the moment, but I believe that functionality was implemented by Winston itself, we only provide exceptionMeta option to convert an error to some metadata.

Readme is clearly outdated.

bithavoc avatar Mar 05 '21 15:03 bithavoc

@codingthat Ok found it in the express.js 2.x docs at https://expressjs.com/2x/guide.html

app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));

bithavoc avatar Mar 05 '21 16:03 bithavoc

Oh yeah, I had missed the express vs. expressWinston difference in @weeco 's original description, too.

codingthat avatar Mar 08 '21 10:03 codingthat