From e809899c0ca04fb81a7cbd29e7537cab2fc924c7 Mon Sep 17 00:00:00 2001 From: KaKa Lee Date: Mon, 27 Feb 2017 17:08:41 +0800 Subject: [PATCH] Change to use bool to define debug option. --- lg.go | 4 ++-- lg_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lg.go b/lg.go index 67ffc31..d0cf358 100644 --- a/lg.go +++ b/lg.go @@ -26,10 +26,10 @@ func Rfc3339NanoEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder) { } // InitLogger must be first to be called. -func InitLogger(debug string) { +func InitLogger(debug bool) { var cfg zap.Config - if debug == "debug" { + if debug { cfg = zap.NewDevelopmentConfig() } else { cfg = zap.NewProductionConfig() diff --git a/lg_test.go b/lg_test.go index 55fb229..468c19d 100644 --- a/lg_test.go +++ b/lg_test.go @@ -5,6 +5,6 @@ import ( ) func TestLg(t *testing.T) { - InitLogger("debug") + InitLogger(true) L(nil).Info("test message.") }