-
Notifications
You must be signed in to change notification settings - Fork 153
feat(logger): flush buffer on uncaught error decorator #3676
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR introduces the ability to flush the log buffer when an uncaught error occurs in a Lambda handler decorated with injectLambdaContext. Key changes include:
- Adding the flushBufferOnUncaughtError option to the injectLambdaContext decorator.
- Updating docstrings to reflect the new functionality and improve clarity.
- Extending unit tests to cover buffer flushing behavior on uncaught errors.
- Introducing a new constant, UncaughtErrorLogMessage, to standardize the error message logged on uncaught errors.
Reviewed Changes
File | Description |
---|---|
packages/logger/src/Logger.ts | Enhancements in the injectLambdaContext decorator and docstrings |
packages/logger/tests/unit/logBuffer.test.ts | Additional tests covering buffer flushing on uncaught errors |
packages/logger/src/constants.ts | New constant for uncaught error log messages |
packages/logger/src/types/Logger.ts | Update to InjectLambdaContextOptions to include flushBufferOnUncaughtError |
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
|
Summary
Changes
This PR adds a new parameter to the
injectLambdaContext()
class method decorator that allows customers to optionally flush a log buffer whenever their function handler throws an error.The PR also makes slight updates to some of the docstrings in the Logger class that were added during previous PRs, and updates the unit tests for the feature to reduce nesting.
Issue number: closes #3635
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.