Skip to content

refactor(promslog): make NewNopLogger() wrapper around New(); turn on debug log flag #783

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion promslog/slog.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,10 @@ func New(config *Config) *slog.Logger {
// NewNopLogger is a convenience function to return an slog.Logger that writes
// to io.Discard.
func NewNopLogger() *slog.Logger {
return slog.New(slog.NewTextHandler(io.Discard, nil))
// Set log level to debug, in case there are code paths that are only
// triggered when debug logging is enabled.
level := NewLevel()
_ = level.Set("debug")

return New(&Config{Level: level, Writer: io.Discard})
}
Loading