Fixes build issue

remotes/r/develop
Guoqiang Chen 7 years ago
parent c3fa52df39
commit da474fcc77

@ -52,11 +52,11 @@ func (f JSONFormatter) Format(level log.Level, msg string, logger *log.Logger) [
data["line"] = line
data["msg"] = msg
line, err := marshal(data)
serialized, err := marshal(data)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to marshal json, %v\n", err)
}
return line
return serialized
}
func marshal(v interface{}) ([]byte, error) {

@ -2,7 +2,6 @@ package formatters
import (
"bytes"
"io"
"os"
"path/filepath"
"strconv"
@ -49,7 +48,7 @@ func (f TextFormatter) Format(level log.Level, msg string, logger *log.Logger) [
f.isterm = IsTerminal(logger.Out)
host, _ = os.Hostname()
host, _ := os.Hostname()
f.host = []byte(host)
f.pid = []byte(strconv.Itoa(os.Getpid()))

@ -1,6 +1,9 @@
package formatters
import (
"io"
"os"
"golang.org/x/crypto/ssh/terminal"
)

@ -107,7 +107,7 @@ func TestLogOnLevel(t *testing.T) {
for i, tt := range tests {
func() {
defer func() {
// check panic hits
// check panic hits
if err := recover(); err != nil {
if !tt.fns.ispanic {
t.Errorf("Case %d, got panic", i)

Loading…
Cancel
Save