replace logrus with log/slog across all packages (#1)#81
Open
Nicolas-Peiffer wants to merge 1 commit into
Open
replace logrus with log/slog across all packages (#1)#81Nicolas-Peiffer wants to merge 1 commit into
Nicolas-Peiffer wants to merge 1 commit into
Conversation
* replace logrus with log/slog across all packages
Migrate all logging calls from github.com/sirupsen/logrus to the
standard library log/slog (Go 1.21+). Key changes:
- Add pkg/logging package with LevelTrace = slog.Level(-8) constant
and ParseLevel helper shared across cmd and provider packages
- Add github.com/lmittmann/tint for colored text handler (replaces
logrus text formatter with color support)
- Replace logrus-filename hook with slog.HandlerOptions{AddSource: true}
- Rename version.LogrusOutputVersion() to version.LogVersion()
- Accept log levels: trace, debug, info, warn, error, quiet
(drop logrus-specific: warning, fatal, panic)
- logrus.Fatal → slog.Error + os.Exit(1)
- logrus.Trace/Tracef → slog.Log(ctx, logging.LevelTrace, ...)
- logrus.WithFields/WithField/WithError → inline slog key-value pairs
- Remove github.com/keepeye/logrus-filename from go.mod
- logrus remains only as an indirect dependency (pulled by other modules)
https://claude.ai/code/session_01BDmDyCyMiNjx4HMQwPWv7s
* Improve slog usage: structured args, snake_case keys, Fatal helper, LevelVar
- Add logging.Fatal helper (slog.Error + os.Exit(1)) to pkg/logging
- Add activeLogLevel (*slog.LevelVar) in root.go for runtime-adjustable level
- Replace all fmt.Sprintf inside slog calls with structured key-value args
- Fix slog.Error(err.Error()) anti-pattern throughout; pass err as "error" attr
- Fix nil-panic bug in istio.go GenerateDEK (err was nil when request==nil)
- Rename all log keys to snake_case: cobra-cmd→cobra_cmd, keyId→key_id, etc.
- Use real gRPC ctx instead of context.Background() in Encrypt method traces
- Replace slog.Error+os.Exit(1) patterns with logging.Fatal in serve/rotation/test
- Drop unused fmt and os imports where no longer needed
https://claude.ai/code/session_01BDmDyCyMiNjx4HMQwPWv7s
* Update copyright year to 2026 in modified files
https://claude.ai/code/session_01BDmDyCyMiNjx4HMQwPWv7s
* logging: add quiet level that discards all output
Introduce logging.LevelQuiet (slog.Level(math.MaxInt)) and wire it up
so that --log-level=quiet installs slog.DiscardHandler, producing no
log output at all.
- pkg/logging: add LevelQuiet constant, "quiet" case in ParseLevel
- cmd/root.go: detect LevelQuiet in initConfig and short-circuit with
slog.DiscardHandler; update --log-level flag description and shell
completion to include "quiet"
https://claude.ai/code/session_01BDmDyCyMiNjx4HMQwPWv7s
---------
Co-authored-by: Claude <noreply@anthropic.com>
cdanger
approved these changes
May 21, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Migrate all logging calls from github.com/sirupsen/logrus to the standard library log/slog (Go 1.21+). Key changes:
https://claude.ai/code/session_01BDmDyCyMiNjx4HMQwPWv7s
https://claude.ai/code/session_01BDmDyCyMiNjx4HMQwPWv7s
https://claude.ai/code/session_01BDmDyCyMiNjx4HMQwPWv7s
Introduce logging.LevelQuiet (slog.Level(math.MaxInt)) and wire it up so that --log-level=quiet installs slog.DiscardHandler, producing no log output at all.
https://claude.ai/code/session_01BDmDyCyMiNjx4HMQwPWv7s
Proposed Changes
Types of Changes
Verification
Testing
Linked Issues
#48
User-Facing Change
Further Comments
gose and crypto11 will soon replace logrus by log/slog.