Skip to content
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

feat(middleware): log unhandled requests #282

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

feat(middleware): log unhandled requests #282

wants to merge 2 commits into from

Conversation

smackfu
Copy link
Member

@smackfu smackfu commented Nov 27, 2024

Description

Add a log line to parrot-middleware when a response is not handled.

Screenshot 2024-11-27 at 3 24 41 PM

This also exposes the logger on the Parrot object so it can be used by ParrotMiddleware for consistent log styling.

Motivation and Context

Currently parrot only logs when a request is matched. This is great when everything is working but there are times when it is good to see the unhandled requests.

Questions I'm not sure of:

  • Are there use cases where people are expecting a ton of misses and the logs would be junk?
  • Are there use cases where parrot-middleware adding a log line would be confusing?
  • Would it be helpful to log more of the unmatched request, or would it be too much noise?
  • Should this be configurable? And opt-in or opt-out?

How Has This Been Tested?

Packed and ran with a local React module. Added unit tests.

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (adding or updating documentation)
  • Dependency update

Checklist:

  • My change requires a change to the documentation and I have updated the documentation accordingly.
  • My changes are in sync with the code style of this project.
  • There aren't any other open Pull Requests for the same issue/update.
  • These changes should be applied to a maintenance branch.
  • This change requires cross browser checks.
  • This change impacts caching for client browsers.
  • I have added the Apache 2.0 license header to any new files created.

What is the Impact to Developers Using parrot?

Mock misses will be much easier to see, especially when the call is server-side rather than browser.

@smackfu smackfu requested a review from a team as a code owner November 27, 2024 20:31
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.

2 participants