mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 23:47:07 -05:00
test case for stream logger
This commit is contained in:
parent
cb19e4613f
commit
144141b3c3
@ -1,6 +1,7 @@
|
||||
package log
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"github.com/v2ray/v2ray-core/testing/unit"
|
||||
@ -17,3 +18,14 @@ func TestLogLevelSetting(t *testing.T) {
|
||||
assert.Pointer(debugLogger).Equals(noOpLoggerInstance)
|
||||
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
Block a user