fix: adjust log encode output mode (#3676)

This commit is contained in:
MarkJoyMa
2023-10-28 19:46:52 +08:00
committed by GitHub
parent b07df1c344
commit 32600f2619
2 changed files with 10 additions and 4 deletions

View File

@@ -126,6 +126,11 @@ func TestWriteJson(t *testing.T) {
log.SetOutput(&buf)
writeJson(nil, "foo")
assert.Contains(t, buf.String(), "foo")
buf.Reset()
writeJson(hardToWriteWriter{}, "foo")
assert.Contains(t, buf.String(), "write error")
buf.Reset()
writeJson(nil, make(chan int))
assert.Contains(t, buf.String(), "unsupported type")