Add Nop constructor

This commit is contained in:
Olivier Poitrey 2017-06-02 00:24:52 -07:00
parent 6bcd15ecf0
commit 67803eb791
1 changed files with 5 additions and 0 deletions

5
log.go
View File

@ -154,6 +154,11 @@ func New(w io.Writer) Logger {
return Logger{w: lw} return Logger{w: lw}
} }
// Nop returns a disabled logger for which all operation are no-op.
func Nop() Logger {
return New(nil).Level(Disabled)
}
// With creates a child logger with the field added to its context. // With creates a child logger with the field added to its context.
func (l Logger) With() Context { func (l Logger) With() Context {
context := l.context context := l.context