fix log crash when print empty string

This commit is contained in:
dearplain 2022-06-14 10:41:12 +08:00 committed by GitHub
parent bdc77568d7
commit 5a78094b6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -209,7 +209,7 @@ func (l *Logger) Output(callDepth int, level int, format string, v ...interface{
buf = append(buf, s...)
if s[len(s)-1] != '\n' {
if len(s) == 0 || s[len(s)-1] != '\n' {
buf = append(buf, '\n')
}