From 67803eb791a544e3027e95c6c5753bb9cba702a7 Mon Sep 17 00:00:00 2001 From: Olivier Poitrey Date: Fri, 2 Jun 2017 00:24:52 -0700 Subject: [PATCH] Add Nop constructor --- log.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/log.go b/log.go index a74b310..6bb0ef9 100644 --- a/log.go +++ b/log.go @@ -154,6 +154,11 @@ func New(w io.Writer) Logger { 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. func (l Logger) With() Context { context := l.context