TUN-3194: Don't render log output when level is not enabled

This commit is contained in:
Igor Postelnik
2020-07-23 18:36:31 -05:00
parent cf1c9a3083
commit 4791ba3b87
6 changed files with 74 additions and 43 deletions

View File

@@ -6,13 +6,19 @@ import (
"github.com/stretchr/testify/assert"
)
type outputFunc func(b []byte)
func (f outputFunc) WriteLogLine(data []byte) {
f(data)
}
func TestWriteManger(t *testing.T) {
testData := []byte(string("hello Austin, how are you doing?"))
waitChan := make(chan []byte)
m := NewWriteManager()
m.Append(testData, func(b []byte) {
m.Append(testData, outputFunc(func(b []byte) {
waitChan <- b
})
}))
resp := <-waitChan
assert.Equal(t, testData, resp)
}