-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
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
Fix req object placement #322
Conversation
customReceivedObject: function (req) { | ||
return { req } | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am bit skeptical about this test. Not sure if this change is ok or I rather should update the source code to include req at this line https://github.com/pinojs/pino-http/blob/master/logger.js#L191 as const receivedObjectResult = onRequestReceivedObject !== undefined ? onRequestReceivedObject(req, res, undefined) : { [reqKey]: req }
and remove the addition in the test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately creating a child logger with the given request set is critical to keep attributing all logs to the given request.
Not sure if I follow. I believe it does keep the request set to all logs having it this way. Line 191 in 77191ae
that why Im not sure about that one test. If the req should be added to this false evaluated condition then all logs will contain req/res objects |
I've run the master
This PR:
|
Fixes #307 (comment)