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

fix(logger): decorated class methods cannot access this #1060

Merged

Conversation

dreamorosi
Copy link
Contributor

Description of your changes

Description of your changes

As described in #1058 the decorator implementation was affected by an issue that prevented the decorated method/class to access other class members as the value of this was passed incorrectly.

This PR aims at fixing the issue, creating an unit test case, making minimal changes to the function in the e2e test to verify the change, and update docstrings/docs.

A long form explanation of the issue can be found at #1055, when merged this PR will close #1058.

How to verify this change

See checks below the PR, also see the results of the e2e test run.

Related issues, RFCs

Issue number: #1058

PR status

Is this ready for review?: YES
Is it a breaking change?: NO

Checklist

  • My changes meet the tenets criteria
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in areas that should be flagged with a TODO, or hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding changes to the examples
  • My changes generate no new warnings
  • The code coverage hasn't decreased
  • I have added tests that prove my change is effective and works
  • New and existing unit tests pass locally and in Github Actions
  • Any dependent changes have been merged and published in downstream module
  • The PR title follows the conventional commit semantics

Breaking change checklist

N/A


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

@dreamorosi dreamorosi added bug Something isn't working logger This item relates to the Logger Utility fix labels Aug 14, 2022
@dreamorosi dreamorosi self-assigned this Aug 14, 2022
@dreamorosi dreamorosi linked an issue Aug 14, 2022 that may be closed by this pull request
@dreamorosi
Copy link
Contributor Author

Note to reviewers: don't merge this until #1054 is merged.

Copy link
Contributor

@ijemmy ijemmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small nit.

Also, similar to #1055, we should also update the examples/cdk/src/*.Decorator.ts files. They still don't use .bind() method. We can have this in another PR if you prefer (then I'll approve this).

ijemmy
ijemmy previously approved these changes Aug 16, 2022
Copy link
Contributor

@ijemmy ijemmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

Discussed with @dreamorosi , we'll go with this to push the fix first.

The example will be updated in a separated PR.

ijemmy
ijemmy previously approved these changes Aug 16, 2022
@dreamorosi dreamorosi merged commit 73990bb into main Aug 18, 2022
@dreamorosi dreamorosi deleted the 1058-bug-logger-decorated-class-methods-cannot-access-this branch August 18, 2022 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working logger This item relates to the Logger Utility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: decorated class methods cannot access this in Logger
3 participants