From 3a862061e2590b726f8378ff30005e0c08deaf80 Mon Sep 17 00:00:00 2001 From: Nicolas JUHEL Date: Thu, 16 Apr 2020 13:26:42 +0200 Subject: [PATCH] Fix Gin Logger by Viper Logger --- njs-logger/level.go | 4 ++-- njs-logger/logger.go | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/njs-logger/level.go b/njs-logger/level.go index 8f3ae7b2..d952ad32 100644 --- a/njs-logger/level.go +++ b/njs-logger/level.go @@ -112,8 +112,8 @@ func SetLevel(level Level) { DebugLevel.Logf("Change Log Level to %s", logrus.GetLevel().String()) } -func setGinLogTrace() { - if !enableGIN { +func setViperLogTrace() { + if !enableVPR { return } diff --git a/njs-logger/logger.go b/njs-logger/logger.go index 2f791dc6..a49c2e5d 100644 --- a/njs-logger/logger.go +++ b/njs-logger/logger.go @@ -55,7 +55,7 @@ var ( timestamp = true filetrace = false enableGID = false - enableGIN = true + enableVPR = true ) // GetLogger return a golang log.logger instance linked with this main logger @@ -97,7 +97,7 @@ func Timestamp(enable bool) { // This option is apply for all message except info message func FileTrace(enable bool) { filetrace = enable - setGinLogTrace() + setViperLogTrace() } // EnableColor Reconfigure the current logger to use color in messages format. @@ -116,9 +116,9 @@ func DisableColor() { updateFormatter(nilFormat) } -// EnableGIN or not the Gin Logger configuration -func EnableGIN(enable bool) { - enableGID = enable +// EnableViperLog or not the Gin Logger configuration +func EnableViperLog(enable bool) { + enableVPR = enable SetLevel(curLevel) }