express-winston
express-winston copied to clipboard
Omit stack + trace on errorLogger
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?
I don't see dumpExceptions in the repo anywhere either with a GitHub search, and TS complains about it.
@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.
@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 }));
Oh yeah, I had missed the express vs. expressWinston difference in @weeco 's original description, too.