Closed snorremd closed 7 years ago
Per https://github.com/hapijs/good/blob/master/lib/utils.js#L88-L94
The includes
options are only used when logging responses, not request.log
.
Thank you for your speedy answer.
My question then becomes: is it not a valid use case to log the request headers and request payload for the request
events? In a scenario where you receive a Hapi request, but your route handler fails before returning a response, you may want to know what the request headers and payload were in order to debug the failure.
At the very least the documentation could be clearer about the type of log event the includes
option operate.
I'd certainly take a PR for the documentation update if it is not clear.
Can we log the request or not ? I am sorry its still not clear.
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
Hello,
I'm trying to log requests via request.log() and want the log output to include the headers and payload. I use the options as described in the documentation, but to no avail. It seems only the response event includes this data. The documentation states that:
Therefore this seems like an unintended behavior to me, but perhaps I'm misunderstanding the documentation?
I use the following versions of hapi, good, and good-squeeze.
hapi 15.0.3 good 7.0.2 good-squeeze 5.0.0
Minimal example:
Output from request.log():
Output from response logging includes the request payload and header.