Closed naseemkullah closed 1 year ago
That's a great one ;).
Ha! I just realized custom messages by route/res is already possible, e.g.:
customSuccessMessage: (req, res) => {
if (req.url === '/foo' && res.statusCode === 200) {
return 'good foo event.';
}
return 'request completed.';
},
While this is not setting it at runtime, the desired outcome is the same.
Closing since functionality already provided 🚀
I've recently discovered and fallen in love with req.log.setBindings() and am consolidating disparate logs during requests into just one rich log upon request completion.
A cherry on top would be to be able to override the on completed/error message depending on the route and response. My current workaround is to set an "eventName" property before request completes. Thoughts?