mirror of https://github.com/v2ray/v2ray-core
test case for stream logger
parent
cb19e4613f
commit
144141b3c3
|
@ -1,6 +1,7 @@
|
||||||
package log
|
package log
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/v2ray/v2ray-core/testing/unit"
|
"github.com/v2ray/v2ray-core/testing/unit"
|
||||||
|
@ -17,3 +18,14 @@ func TestLogLevelSetting(t *testing.T) {
|
||||||
assert.Pointer(debugLogger).Equals(noOpLoggerInstance)
|
assert.Pointer(debugLogger).Equals(noOpLoggerInstance)
|
||||||
assert.Pointer(infoLogger).Equals(streamLoggerInstance)
|
assert.Pointer(infoLogger).Equals(streamLoggerInstance)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestStreamLogger(t *testing.T) {
|
||||||
|
assert := unit.Assert(t)
|
||||||
|
|
||||||
|
buffer := bytes.NewBuffer(make([]byte, 0, 1024))
|
||||||
|
logger := &streamLogger{
|
||||||
|
writer: buffer,
|
||||||
|
}
|
||||||
|
logger.WriteLog("TestPrefix: ", "Test %s Format", "Stream Logger")
|
||||||
|
assert.Bytes(buffer.Bytes()).Equals([]byte("TestPrefix: Test Stream Logger Format\n"))
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue