From d66803a136375b17283fc3bc560f5fb97e09495c Mon Sep 17 00:00:00 2001 From: yu Date: Wed, 29 Jul 2020 19:45:25 +0800 Subject: [PATCH] fix bug https://github.com/micro/go-micro/issues/1883 (#1884) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix #1883 * fix #1883 Co-authored-by: 杨羽 --- util/log/log.go | 1 + util/log/log_test.go | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 util/log/log_test.go diff --git a/util/log/log.go b/util/log/log.go index 75167947..e86a757b 100644 --- a/util/log/log.go +++ b/util/log/log.go @@ -209,6 +209,7 @@ func GetLogger() dlog.Log { // SetLevel sets the log level func SetLevel(l Level) { atomic.StoreInt32((*int32)(&level), int32(l)) + nlog.Init(nlog.WithLevel(levelToLevel(l))) } // GetLevel returns the current level diff --git a/util/log/log_test.go b/util/log/log_test.go new file mode 100644 index 00000000..872b02c4 --- /dev/null +++ b/util/log/log_test.go @@ -0,0 +1,13 @@ +package log + +import ( + "testing" +) + +func TestDebug(t *testing.T) { + SetLevel(LevelDebug) + Debug(123) +} +func TestMain(m *testing.M) { + m.Run() +}