Merge pull request #4630 from cugxuan/master

[fix bug]console more empty line
This commit is contained in:
Ming Deng 2021-05-22 15:25:29 +08:00 committed by GitHub
commit 6ccdd9349c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -62,7 +62,7 @@ func (c *consoleWriter) Format(lm *LogMsg) string {
msg = strings.Replace(msg, levelPrefix[lm.Level], colors[lm.Level](levelPrefix[lm.Level]), 1)
}
h, _, _ := formatTimeHeader(lm.When)
bytes := append(append(h, msg...), '\n')
bytes := append(h, msg...)
return string(bytes)
}

View File

@ -76,7 +76,7 @@ func TestFormat(t *testing.T) {
Prefix: "Cus",
}
res := log.Format(lm)
assert.Equal(t, "2020/09/19 20:12:37.000 \x1b[1;44m[D]\x1b[0m Cus Hello, world\n", res)
assert.Equal(t, "2020/09/19 20:12:37.000 \x1b[1;44m[D]\x1b[0m Cus Hello, world", res)
err := log.WriteMsg(lm)
assert.Nil(t, err)
}