summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/labstack/gommon/log/log.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/labstack/gommon/log/log.go')
-rw-r--r--vendor/github.com/labstack/gommon/log/log.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/vendor/github.com/labstack/gommon/log/log.go b/vendor/github.com/labstack/gommon/log/log.go
index 06fa37e0..25f719aa 100644
--- a/vendor/github.com/labstack/gommon/log/log.go
+++ b/vendor/github.com/labstack/gommon/log/log.go
@@ -391,7 +391,7 @@ func (l *Logger) log(level Lvl, format string, args ...interface{}) {
if err == nil {
s := buf.String()
i := buf.Len() - 1
- if s[i] == '}' {
+ if i >= 0 && s[i] == '}' {
// JSON header
buf.Truncate(i)
buf.WriteByte(',')
@@ -404,7 +404,9 @@ func (l *Logger) log(level Lvl, format string, args ...interface{}) {
}
} else {
// Text header
- buf.WriteByte(' ')
+ if len(s) > 0 {
+ buf.WriteByte(' ')
+ }
buf.WriteString(message)
}
buf.WriteByte('\n')