-
Notifications
You must be signed in to change notification settings - Fork 593
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
Use logr with zap throughout #4688
Conversation
b7f2f7a
to
e4268d8
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #4688 +/- ##
=======================================
- Coverage 77.9% 77.7% -0.2%
=======================================
Files 163 162 -1
Lines 18537 18471 -66
=======================================
- Hits 14451 14363 -88
- Misses 3275 3293 +18
- Partials 811 815 +4
☔ View full report in Codecov by Sentry. |
1b009f2
to
79e166f
Compare
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.
Great effort (I can't wait for the merge)🎖️
FYI: in go-logr
docs, there is a good go-logr vs. slog, worth checking. slog
is less feature reach
Replace use of logrus with logr, and use zap as the underlying engine instead of logrus. The controller now uses a single logging interface throughout. As logr does not use semantic log levels, controller log level options are now collapsed into trace, debug, info, and errors only. Warn is identical to info. Console formatting uses zap's tab-delimited, no field name format. JSON formatting should be compatible with the old logrus format for existing fields. Remove the log stifler, which was unused. zap has built-in sampling if we wish to use it, though it is not enabled, to match previous behavior.
Fix TODOs or remove note-only TODOs.
e17661b
to
e6f0c63
Compare
From sync/other feedback:
|
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.
Just some nits and the conflicts (once again) and I believe this is ready 👍
Might want to adjust the PR title to e.g. adhere to conventional commits. |
7644fe7
to
a7f449d
Compare
I override the squash commit title and message if I use it instead of rebase and merge. |
What this PR does / why we need it:
Converts pure logrus subsystems to logr.
Uses zapr+zap in place of logrusr+logrus to create the logr.Logger.
Which issue this PR fixes:
Makes logging consistent throughout the project, except for the odd KLog line from client-go and one hack script that I don't really care about.
Allows swapping out logging engines without touching individual log lines.
Fix #1893
Special notes for your reviewer:
Review open for code. Want to discuss the below in sync before merging or building additional functionality.
WARN
, since neither we nor controller-runtime use levels greater than 1 (debug, effectively) often, so the info -> debug -> info again progression doesn't really show up. We could try fixing that upstream.V(util.InfoLevel).Info()
and the like) to log lines I converted. These don't do anything useful at present, but I figure it lets us change them later via the constants if we decide to do something fancier with the verbosity levels.PR Readiness Checklist:
Complete these before marking the PR as
ready to review
:CHANGELOG.md
release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR