diff --git a/common/log/log_test.go b/common/log/log_test.go index 447ae2f91..001884f07 100644 --- a/common/log/log_test.go +++ b/common/log/log_test.go @@ -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")) +}