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-logger): log request errors #4252

Merged
merged 1 commit into from
Mar 7, 2023
Merged

Conversation

simonbuchan
Copy link
Contributor

@simonbuchan simonbuchan commented Dec 4, 2022

Issue

Fixes: #1912

Description

Logs to logger.error if the next function rejects or throws.

Testing

Other than unit tests, this is essentially the custom middleware I've been using in our auth code for about a week now (including going through our tests).

Additional context

This probably isn't 100% - e.g. it doesn't test for logger.info being present but not a function, and I'm not sure if it's OK to use ?..

Note that you can't get the output for an error response, since it failed to create it, logically enough!

It's probably worthwhile documenting the logging output format, though I don't know where that should go.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@simonbuchan simonbuchan requested a review from a team as a code owner December 4, 2022 23:49
@trivikr trivikr added the p2 This is a standard priority issue label Mar 7, 2023
@kuhe kuhe self-assigned this Mar 7, 2023
@kuhe kuhe merged commit 8c667ff into aws:main Mar 7, 2023
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p2 This is a standard priority issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Logger should log error in case of failure
3 participants