Use slog (stdlib) as default logger, move logrus to subpackage#20
Merged
paganotoni merged 4 commits intomainfrom Mar 21, 2026
Merged
Use slog (stdlib) as default logger, move logrus to subpackage#20paganotoni merged 4 commits intomainfrom
paganotoni merged 4 commits intomainfrom
Conversation
This change makes the logger package use Go's standard library log/slog
as the default implementation instead of logrus. The logrus implementation
is moved to a subpackage (logrus/) for users who still need it.
Changes:
- Root package now uses log/slog (stdlib) - zero external dependencies
- logrus implementation moved to logrus/ subpackage
- Updated go.mod to require Go 1.25
- Modernized code: use 'any' instead of 'interface{}'
- Added package-level documentation
- Removed GO111MODULE checks from Makefile
Benefits:
- Users only depend on logrus if they explicitly import the subpackage
- Smaller dependency tree for most users
- Modern Go practices with slog
BREAKING CHANGE: The default logger is now slog-based. Users relying on
logrus-specific behavior should import github.com/gobuffalo/logger/logrus
2420abc to
58b0e31
Compare
- Update module path to github.com/gobuffalo/logger/v2 - Move slog implementation to unexported defaultFieldLogger in default.go - Separate interfaces into logger.go (Logger, FieldLogger, Outable) - Rename logrus.Logrus to unexported fieldLogger for consistency - Update logrus dependency to v1.9.4 - Remove outable.go and slog.go (consolidated into default.go) BREAKING CHANGE: Module path now includes /v2 suffix
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.
Summary
This PR refactors the logger to use Go's standard library
log/slogas the default implementation instead of logrus. The logrus implementation is moved to a subpackage for users who still need it.Changes
log/slog(stdlib) with zero external dependenciesanyinstead ofinterface{}Benefits
github.com/gobuffalo/logger/logrusMigration Guide
For existing users (no changes needed)
For users who need logrus
Breaking Changes
The default logger is now slog-based. While the
LoggerandFieldLoggerinterfaces remain the same, there may be subtle behavioral differences:Users relying on logrus-specific behavior should import the logrus subpackage.