We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Is it possible to log response body with the request complete log?
Currently in the res serializers, it's not possible to access the returning body to add it to the final log.
The text was updated successfully, but these errors were encountered:
@kundkingan did you figure this out?
Sorry, something went wrong.
You can catch the context using a property with a getter
const middleware = (req, res, next) => { const logger = pinoHttp({ serializers: { res(res) { res.body = res.raw.locals.body; return res; }, }, }) logger( req, Object.defineProperty(res, 'locals', { get() { return { body: res.body }; }, enumerable: true, configurable: true, }), ) next(); };
Haven't tried it out yet!
No branches or pull requests
Is it possible to log response body with the request complete log?
Currently in the res serializers, it's not possible to access the returning body to add it to the final log.
The text was updated successfully, but these errors were encountered: