This repository was archived by the owner on Jan 13, 2026. It is now read-only.
Replace logrus by klog#4180
Merged
Merged
Conversation
absoludity
approved these changes
Jan 27, 2022
| func chartImportWorker(repoURL *url.URL, r *OCIRegistry, chartJobs <-chan pullChartJob, resultChan chan pullChartResult) { | ||
| for j := range chartJobs { | ||
| log.WithFields(log.Fields{"name": j.AppName, "tag": j.Tag}).Debug("pulling chart") | ||
| log.V(4).Infof("pulling chart, name=%s, tag=%s", j.AppName, j.Tag) |
Contributor
There was a problem hiding this comment.
Why not use klog's support for structured logging here and above, with something like:
Suggested change
| log.V(4).Infof("pulling chart, name=%s, tag=%s", j.AppName, j.Tag) | |
| log.V(4).InfoS("pulling chart", "name", j.AppName, "tag", j.Tag) |
or even
Suggested change
| log.V(4).Infof("pulling chart, name=%s, tag=%s", j.AppName, j.Tag) | |
| log.V(4).InfoS("pulling chart", "chartJob", j) |
Better eg showing the difference: https://go.dev/play/p/EW5ZQh7MDXI
Or maybe you want to do that separately so it's consistent across the codebase (personally I'd think it OK to do it as we update, like here, but up to you).
Contributor
Author
There was a problem hiding this comment.
Thanks for the suggestion and the playground example. I haven't given it a try yet. Really interesting.
As per #3848 (comment), I already have planned to do so in a separate PR once this stack of PRs became merged. I've added a card to our board not to forget about it. I've created an issue.
9f58bce to
1c20257
Compare
Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>
Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>
c3f2ed6 to
0b12a08
Compare
Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com> Conflicts: cmd/apprepository-controller/cmd/root.go cmd/asset-syncer/cmd/root.go cmd/asset-syncer/server/utils.go cmd/assetsvc/cmd/root.go cmd/kubeapps-apis/cmd/root.go pkg/agent/docker_secrets_postrenderer.go
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the change
This PR continues the effort started some time ago in unifying the logging libraries. We opted for
klog, the one used in Kubernetes. Some minor changes have been introduced in order to adapt the log operations to the ones available in klog (noWithParamsorWithErrorare available here).Benefits
Reduce same-purpose deps. It also simplifies the task of moving to structured logging as we were asked in the past.
Possible drawbacks
N/A
Applicable issues
Additional information
N/A