Merge pull request #4760 from flycash/develop

Merge master. Prepare for release
This commit is contained in:
Ming Deng
2021-09-03 12:55:52 +08:00
committed by GitHub
13 changed files with 81 additions and 24 deletions

View File

@@ -62,8 +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')
return string(bytes)
return string(append(h, msg...))
}
func (c *consoleWriter) SetFormatter(f LogFormatter) {

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)
}