I'm unsure whether this is the right place for this issue (or if it's rather a Winston thing), but when logging Boom objects with Winston (e.g. Internal Server Errors), every error contains Boom's reformat function, making the log output somewhat confusing.
Here's an example:
error: message=kaputt, stack=Error: kaputt
at Object.<anonymous> (auth.ts:27:16)
at Generator.next (<anonymous>)
at auth.ts:7:71
at new Promise (<anonymous>)
...
at Layer.handle [as handle_request] (node_modules/express/lib/router/layer.js:95:5), data=null, isBoom=true, isServer=true, statusCode=500, statusCode=500, error=Internal Server Error, message=An internal server error occurred, , reformat=function (debug = false) {
this.output.payload.statusCode = this.output.statusCode;
this.output.payload.error = internals.codes.get(this.output.statusCode) || 'Unknown';
if (this.output.statusCode === 500 && debug !== true) {
this.output.payload.message = 'An internal server error occurred'; // Hide actual error from user
}
else if (this.message) {
this.output.payload.message = this.message;
}
}, typeof=internal(message, data, statusCode = 500) {
return internals.serverError(message, data, statusCode, internals.Boom.internal);
}
The code producing this is basically just the following Express error handler middleware:
export default () => (err, req, res, next) => {
Boom.boomify(err);
if (err.isServer) {
logger.error(err);
}
...
}
Any ideas? I'm using winston@2 and the boom@7.3.0
I'm unsure whether this is the right place for this issue (or if it's rather a Winston thing), but when logging Boom objects with Winston (e.g. Internal Server Errors), every error contains Boom's
reformatfunction, making the log output somewhat confusing.Here's an example:
The code producing this is basically just the following Express error handler middleware:
Any ideas? I'm using winston@2 and the boom@7.3.0