optimize: improve performance on log disabled (#3916)

This commit is contained in:
Kevin Wan
2024-02-17 14:55:48 +08:00
committed by GitHub
parent bfe8335cb2
commit 0f1d4c6bca
3 changed files with 8 additions and 6 deletions

View File

@@ -666,6 +666,7 @@ func TestDisable(t *testing.T) {
WithMaxSize(1024)(&opt)
assert.Nil(t, Close())
assert.Nil(t, Close())
assert.Equal(t, uint32(disableLevel), atomic.LoadUint32(&logLevel))
}
func TestDisableStat(t *testing.T) {
@@ -680,7 +681,7 @@ func TestDisableStat(t *testing.T) {
}
func TestSetWriter(t *testing.T) {
atomic.StoreUint32(&disableLog, 0)
atomic.StoreUint32(&logLevel, 0)
Reset()
SetWriter(nopWriter{})
assert.NotNil(t, writer.Load())