Skip to content

Conversation

@RafaelMeir4
Copy link

@RafaelMeir4 RafaelMeir4 commented Dec 2, 2025

Summary

This PR allows autoLogging.ignore callback to receive the response object
as a second parameter, enabling users to filter logs based on response
properties like status code.

This addresses the use case where users want to only log errored requests
(e.g., only log when res.statusCode >= 400).

Changes

  • Modified autoLogging.ignore to be called after response completion
  • The callback now receives (req, res) instead of just (req)
  • Updated documentation to reflect the new signature
  • Added unit test for status code filtering

Issue

#356

Example usage

autoLogging: {
  ignore: (req, res) => res.statusCode < 400  // only log errors
}

Backwards Compatibility

Existing code using ignore: (req) => {...} will continue to work
since the res parameter is optional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant