Currently, the middleware logs only the response status code. While this is useful, it lacks enough context when analyzing requests in CloudWatch Logs Insights or other log analysis tools.
To improve debugging and monitoring, the response body should also be included in the log entry. This will provide more complete visibility into the system’s behavior and help correlate request/response cycles effectively.
What needs to be done:
- Extend the middleware to log the response body along with the status code.
- Ensure the response is structured in JSON format for compatibility.
- Avoid logging excessively large or sensitive data.