Closed jhoffland closed 1 year ago
Putting the request and response data in the context, makes it also possible to use placeholders in the log message. Resulting in much smaller messages, better supported by log parsers/transformers (in case of big requests/responses).
Sorry for the late reply.
Could you please clarify what you wish to see in the log message?
You mentioned you can enable the DEBUG
level and it already provides some more information like request and response headers.
What would you like to see more?
Closing due to inactivity.
Problem you are trying to solve: processing the sent request and received response within the codebase.
Solution you'd like: the request headers and body and response headers and body being add to the log message context.
Alternatives you've considered: extracting the data from the log message.
Additional context: Currently, it is possible to log debug messages, containing information about sent requests and received responses. I would like to process parts of this data for testing and validation purposes within our PHP project. Currently all the needed details are inside the log message. Processing request/response headers and body would be much easier and trustworthy if they are (also) attached as context to the log message. The context array could e.g. consist of the four keys
request_headers
,request_body
,response_headers
&response_body
, with JSON encoded values.