Skip to content

Commit 487c180

Browse files
authored
refactor(promslog): make NewNopLogger() wrapper around New() (#783)
* refactor(promslog): make `NewNopLogger()` wrapper around `New()` While discussing the fix for prometheus/prometheus#16466, it was pointed out that our `promslog.NewNopLogger()` convenience function would benefit from using the same logic used when initializing loggers with `promslog.New()`. By refactoring NewNopLogger to wrap New, it inherits that same setup logic. Signed-off-by: TJ Hoplock <[email protected]> * fix(promslog): don't set NewNopLogger to debug level Signed-off-by: TJ Hoplock <[email protected]> --------- Signed-off-by: TJ Hoplock <[email protected]>
1 parent b8eddd7 commit 487c180

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

promslog/slog.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,5 +266,5 @@ func New(config *Config) *slog.Logger {
266266
// NewNopLogger is a convenience function to return an slog.Logger that writes
267267
// to io.Discard.
268268
func NewNopLogger() *slog.Logger {
269-
return slog.New(slog.NewTextHandler(io.Discard, nil))
269+
return New(&Config{Writer: io.Discard})
270270
}

0 commit comments

Comments
 (0)