-
Notifications
You must be signed in to change notification settings - Fork 26
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
fix(logging): check if ILambdaContext is valid in LoggingLambdaContext.Extract #791
fix(logging): check if ILambdaContext is valid in LoggingLambdaContext.Extract #791
Conversation
… it. Do this to avoid null reference exceptions.
Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need. |
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.
Thank you! Looks great!
libraries/tests/AWS.Lambda.Powertools.Logging.Tests/Context/LambdaContextTest.cs
Outdated
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #791 +/- ##
===========================================
- Coverage 74.04% 74.04% -0.01%
===========================================
Files 210 210
Lines 8404 8402 -2
Branches 910 910
===========================================
- Hits 6223 6221 -2
Misses 1883 1883
Partials 298 298 ☔ View full report in Codecov by Sentry. |
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.
Thank you! GTM
Thanks for the quick review @hjgraca. Can you let me know what is the expected timeline to get it merged and released into a new nuget package? Much appreciated. |
Merged, right now :) |
Did you intend to close the pull request or was a mistake? |
sorry, my mistake! i meant to close a comment. Thanks for re-opening. |
|
These buttons are misleading :) We can wait until March 11th. |
Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience! |
Issue number: 792
Summary
Check if the ILambdaContext is valid before extracting and using it. Powertools Logging already checks if the ILambdaContext is null, but only if it is the FIRST parameter, not the second or third, etc.
Changes
User experience
Previously, unit tests could be hard to write if a method we call had the [Logging] attribute on it, because then we had to ensure the LambdaContext was set and valid. Now we don't have to worry about the lambda context and can just focus on the code.
This would occur if there was a method like:
Checklist
Please leave checklist items unchecked if they do not apply to your change.
Is this a breaking change? **NO**
RFC issue number:
Checklist:
Acknowledgment
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.