Merge pull request #593 from sirupsen/buffer_length

Use buffer length to avoid generating strings every time
This commit is contained in:
Damien Mathieu 2017-07-25 10:20:43 +02:00 committed by GitHub
commit 86bd21e371
1 changed files with 1 additions and 1 deletions

View File

@ -154,7 +154,7 @@ func (f *TextFormatter) needsQuoting(text string) bool {
} }
func (f *TextFormatter) appendKeyValue(b *bytes.Buffer, key string, value interface{}) { func (f *TextFormatter) appendKeyValue(b *bytes.Buffer, key string, value interface{}) {
if b.String() != "" { if b.Len() > 0 {
b.WriteByte(' ') b.WriteByte(' ')
} }
b.WriteString(key) b.WriteString(key)