Skip to content

Commit 4c5891c

Browse files
authored
Add nop logger (#324)
1 parent 5e7f706 commit 4c5891c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

logp/logger.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ func NewLogger(selector string, options ...LogOption) *Logger {
5353
return newLogger(loadLogger().rootLogger, selector, options...)
5454
}
5555

56+
// NewNopLogger returns a no-op logger
57+
func NewNopLogger() *Logger {
58+
logger := zap.NewNop()
59+
return &Logger{logger, logger.Sugar()}
60+
}
61+
5662
// NewProductionLogger returns a production suitable logp.Logger
5763
func NewProductionLogger(selector string, options ...LogOption) (*Logger, error) {
5864
log, err := zap.NewProduction(options...)

0 commit comments

Comments
 (0)