-
Notifications
You must be signed in to change notification settings - Fork 261
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
🐛 Remove logger from scope #1913
Conversation
Scope encapsulates an initialised OpenStack client which can be safely shared between reconciles which share the same credentials. The logger is initialised with context specific to an individual reconcile, so it cannot be shared between reconciles. To avoid code churn we preserve the previous interface of Scope with the creation of scope.WithLogger, which changes the initialisation to ensure that the returned logger always comes from the current reconcile even if the scope was cached. While touching logging in tests, we also take the opportunity to replace uses of logr.Discard with GinkgoLogr or logr/testr as appropriate, so test logs are now captured.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mdbooth The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
✅ Deploy Preview for kubernetes-sigs-cluster-api-openstack ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
👏 👏 🙏 |
/cherry-pick release-0.9 |
@EmilienM: once the present PR merges, I will cherry-pick it on top of release-0.9 in a new PR and assign it to you. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@EmilienM: #1913 failed to apply on top of branch "release-0.9":
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@EmilienM seems the re-apply failed, should we consider manually cherry pick ? |
Scope encapsulates an initialised OpenStack client which can be safely shared between reconciles which share the same credentials. The logger is initialised with context specific to an individual reconcile, so it cannot be shared between reconciles.
To avoid code churn we preserve the previous interface of Scope with the creation of scope.WithLogger, which changes the initialisation to ensure that the returned logger always comes from the current reconcile even if the scope was cached.
While touching logging in tests, we also take the opportunity to replace uses of logr.Discard with GinkgoLogr or logr/testr as appropriate, so test logs are now captured.
Fixes #1840
/hold