From 40230d79e7656a3a37a029535e1a64aad1745ceb Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 1 Oct 2020 16:58:07 +0800 Subject: [PATCH] fix data race --- core/logx/syslog_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/logx/syslog_test.go b/core/logx/syslog_test.go index 5fbd0c65..78903548 100644 --- a/core/logx/syslog_test.go +++ b/core/logx/syslog_test.go @@ -33,10 +33,10 @@ func captureOutput(f func()) string { writer := new(mockWriter) infoLog = writer - prevLevel := logLevel - logLevel = InfoLevel + prevLevel := atomic.LoadUint32(&logLevel) + SetLevel(InfoLevel) f() - logLevel = prevLevel + SetLevel(prevLevel) return writer.builder.String() }