Add Nop constructor
This commit is contained in:
parent
6bcd15ecf0
commit
67803eb791
5
log.go
5
log.go
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue