logr v1.4.1 + SetSlogLogger#396
Conversation
|
This issue is currently awaiting triage. If klog contributors determine this is a relevant issue, they will accept it by applying the The DetailsInstructions 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. |
|
|
||
| "github.com/go-logr/logr/slogr" | ||
| "github.com/go-logr/logr" | ||
|
|
There was a problem hiding this comment.
This blank line should have been added already earlier.
ee73172 to
98c28e2
Compare
This moves slog support into the main package. Go >1.18 is needed for generic type parameters.
| test: | ||
| strategy: | ||
| matrix: | ||
| go-version: [1.18, 1.19, 1.20, 1.21] |
There was a problem hiding this comment.
We were testing with Go 1.2 (float 1.20 = 1.2)...
|
/lgtm |
|
/hold In case someone else wants to review. |
|
Looks good to me |
| ) | ||
|
|
||
| // SetSlogLogger reconfigures klog to log through the slog logger. The logger must not be nil. | ||
| func SetSlogLogger(logger *slog.Logger) { |
There was a problem hiding this comment.
Can you add a corresponding unit test for this function? This can also be used as an example. It is similar to https://github.com/kubernetes/kubernetes/pull/120696/files#diff-e284ecee88b71e68a5cb5630bad5227e3787043dd7ef880d55b5529294e98b47R34-R39
There was a problem hiding this comment.
Good point, thanks for ensuring that I don't take shortcuts... 🥵
I added a ExampleSetSlogLogger in contextual_slog_example_test.go: https://github.com/kubernetes/klog/compare/37230168d33647d10a14966ab1a359d5424110ed..e4deee85f1cbc9ac407804b4a0fc1a38123b62f2
This is syntactic sugar, but it's still useful because it hides logr from developers who only care about klog and slog.
logr v1.4.0 moved the slog support functions in the main package and deprecated slogr.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kaisoz, mengjiao-liu, pohly The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/hold cancel Second review is in. |
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [k8s.io/klog/v2](https://togithub.com/kubernetes/klog) | `v2.110.1` -> `v2.120.1` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>kubernetes/klog (k8s.io/klog/v2)</summary> ### [`v2.120.1`](https://togithub.com/kubernetes/klog/releases/tag/v2.120.1): Prepare klog release for Kubernetes v1.30 (Take 2) [Compare Source](https://togithub.com/kubernetes/klog/compare/v2.120.0...v2.120.1) #### What's Changed - textlogger: allow caller to override stack unwinding by [@​pohly](https://togithub.com/pohly) in [https://github.com/kubernetes/klog/pull/397](https://togithub.com/kubernetes/klog/pull/397) **Full Changelog**: kubernetes/klog@v2.120.0...v2.120.1 ### [`v2.120.0`](https://togithub.com/kubernetes/klog/releases/tag/v2.120.0): Prepare klog release for Kubernetes v1.30 (Take 1) [Compare Source](https://togithub.com/kubernetes/klog/compare/v2.110.1...v2.120.0) #### What's Changed - OWNERS: remove serathius, add mengjiao-liu, promote pohly by [@​pohly](https://togithub.com/pohly) in [https://github.com/kubernetes/klog/pull/394](https://togithub.com/kubernetes/klog/pull/394) - docs: clarify relationship between different features by [@​pohly](https://togithub.com/pohly) in [https://github.com/kubernetes/klog/pull/395](https://togithub.com/kubernetes/klog/pull/395) - Add SafePtr wrapper by [@​kaisoz](https://togithub.com/kaisoz) in [https://github.com/kubernetes/klog/pull/393](https://togithub.com/kubernetes/klog/pull/393) - logr v1.4.1 + SetSlogLogger by [@​pohly](https://togithub.com/pohly) in [https://github.com/kubernetes/klog/pull/396](https://togithub.com/kubernetes/klog/pull/396) #### New Contributors - [@​kaisoz](https://togithub.com/kaisoz) made their first contribution in [https://github.com/kubernetes/klog/pull/393](https://togithub.com/kubernetes/klog/pull/393) **Full Changelog**: kubernetes/klog@v2.110.1...v2.120.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMzguMSIsInVwZGF0ZWRJblZlciI6IjM3LjIzOC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com>
…1721) [](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [k8s.io/klog/v2](https://togithub.com/kubernetes/klog) | `v2.110.1` -> `v2.120.1` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>kubernetes/klog (k8s.io/klog/v2)</summary> ### [`v2.120.1`](https://togithub.com/kubernetes/klog/releases/tag/v2.120.1): Prepare klog release for Kubernetes v1.30 (Take 2) [Compare Source](https://togithub.com/kubernetes/klog/compare/v2.120.0...v2.120.1) #### What's Changed - textlogger: allow caller to override stack unwinding by [@&open-telemetry#8203;pohly](https://togithub.com/pohly) in [https://github.com/kubernetes/klog/pull/397](https://togithub.com/kubernetes/klog/pull/397) **Full Changelog**: kubernetes/klog@v2.120.0...v2.120.1 ### [`v2.120.0`](https://togithub.com/kubernetes/klog/releases/tag/v2.120.0): Prepare klog release for Kubernetes v1.30 (Take 1) [Compare Source](https://togithub.com/kubernetes/klog/compare/v2.110.1...v2.120.0) #### What's Changed - OWNERS: remove serathius, add mengjiao-liu, promote pohly by [@&open-telemetry#8203;pohly](https://togithub.com/pohly) in [https://github.com/kubernetes/klog/pull/394](https://togithub.com/kubernetes/klog/pull/394) - docs: clarify relationship between different features by [@&open-telemetry#8203;pohly](https://togithub.com/pohly) in [https://github.com/kubernetes/klog/pull/395](https://togithub.com/kubernetes/klog/pull/395) - Add SafePtr wrapper by [@&open-telemetry#8203;kaisoz](https://togithub.com/kaisoz) in [https://github.com/kubernetes/klog/pull/393](https://togithub.com/kubernetes/klog/pull/393) - logr v1.4.1 + SetSlogLogger by [@&open-telemetry#8203;pohly](https://togithub.com/pohly) in [https://github.com/kubernetes/klog/pull/396](https://togithub.com/kubernetes/klog/pull/396) #### New Contributors - [@&open-telemetry#8203;kaisoz](https://togithub.com/kaisoz) made their first contribution in [https://github.com/kubernetes/klog/pull/393](https://togithub.com/kubernetes/klog/pull/393) **Full Changelog**: kubernetes/klog@v2.110.1...v2.120.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMzguMSIsInVwZGF0ZWRJblZlciI6IjM3LjIzOC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com>
What this PR does / why we need it:
logr v1.4.1 moved the slog support code into the main package, which is now used by klog instead of the deprecated slogr package.
SetSlogLogger syntactic sugar, but it's still useful because it hides logr from developers who only care about klog and slog.
Which issue(s) this PR fixes
Related-to: kubernetes/kubernetes#120696 (comment)
/cc @thockin
Release note: