From 12181bd441185edddf704bb44b30fa365535b65d Mon Sep 17 00:00:00 2001 From: Shu xian Date: Thu, 6 Feb 2020 02:16:57 +0800 Subject: [PATCH] fix LevelInfo > LevelWarn (#1162) --- util/log/log.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/util/log/log.go b/util/log/log.go index ddd6e929..67c3b75c 100644 --- a/util/log/log.go +++ b/util/log/log.go @@ -4,19 +4,20 @@ package log import ( "fmt" "os" + "sync/atomic" "time" "github.com/micro/go-micro/v2/debug/log" ) // level is a log level -type Level int +type Level int32 const ( LevelFatal Level = iota LevelError - LevelInfo LevelWarn + LevelInfo LevelDebug LevelTrace ) @@ -186,7 +187,7 @@ func GetLogger() log.Log { // SetLevel sets the log level func SetLevel(l Level) { - level = l + atomic.StoreInt32((*int32)(&level), int32(l)) } // GetLevel returns the current level