Fix data race (#8206)

* Fix data race

* Fix data race in modules/log

* Make the scope of lock finner-grained

* Use syc.Map

* Fix missing change in the test

* Do not export LoggerMap
This commit is contained in:
Mura Li
2019-09-17 17:40:28 +08:00
committed by Lauris BH
parent 267fbbf201
commit aaf975bff1
3 changed files with 57 additions and 20 deletions

View File

@@ -143,7 +143,7 @@ func TestNewNamedLogger(t *testing.T) {
level := INFO
err := NewNamedLogger("test", 0, "console", "console", fmt.Sprintf(`{"level":"%s"}`, level.String()))
assert.NoError(t, err)
logger := NamedLoggers["test"]
logger, _ := NamedLoggers.Load("test")
assert.Equal(t, level, logger.GetLevel())
written, closed := baseConsoleTest(t, logger)