-
Notifications
You must be signed in to change notification settings - Fork 146
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(logger): fix handling of additional log keys #614
Conversation
Hi @AWSDB thanks for the PR, have set aside some time to review it later today. |
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.
Looks good to me, thanks a ton for taking up this PR
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.
LGTM.
@dreamorosi We cannot run E2E on PR from a forked repo. This is another gap in our process :( I ran Here's the run: https://github.com/awslabs/aws-lambda-powertools-typescript/runs/5464360763?check_suite_focus=true Will merge once it has passed. |
Yep, coincidentally we discussed this earlier this morning during the usual meeting. @flochaz is going to look at it in the next days to see if we can make the e2e tests run for this type of contributions. Thanks for the review btw! |
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.
Reran e2e result passes : https://github.com/awslabs/aws-lambda-powertools-typescript/runs/5466416155?check_suite_focus=true
@dreamorosi Seem like a bad version in package-lock.json
. Rebasing to the latest main solves the issue. Can we have 2nd review?
@dreamorosi As @ijemmy pointed out, there seemed to be an issue with the |
Thanks both for following up on this. Unfortunately I have made a release just a couple of hours ago so this change will be included in the next one. Merged. |
Description of your changes
Logger
accepts a second parameter that allows to append additional keys and values to a single log item.Currently, there are 5 use cases that are supported for this:
However, the current implementation allows passing simple strings, arrays, and any other
unknown
objects (single or multiple) as a second (third, fourth, ...) parameter, causing unwanted side effects.This PR addresses this issue by aligning the implementation to other AWS Lambda Powertools flavors like e.g. Python.
So, one more use cases is allowed:
Additionally:
{ key: 'value' }
(key-value) kind of onesunknown
objects is not supported anymore (BREAKING)Error
s is not supported anymore (BREAKING)How to verify this change
See the unit tests.
Check the updated documentation (section "Appending additional log keys and values to a single log item").
Try to pass unsupported objects, e.g.:
Related issues, RFCs
#565
PR status
Is this ready for review?: YES
Is it a breaking change?: YES
Checklist
Breaking change checklist
The TypeScript type system / compiler will produce errors for any unsupported API usage.
Users will have to fix those errors by converting any unsupported objects into strings or supported key-value objects.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.