Skip to content

Commit

Permalink
Revert "[RFC][PL-516] Adapt go logger to send missing mandatory fields (
Browse files Browse the repository at this point in the history
#5)"

This reverts commit b027710.
  • Loading branch information
raffo0707 authored Mar 23, 2018
1 parent b027710 commit 2554775
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
11 changes: 4 additions & 7 deletions internal/logrus.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"runtime"
"strings"

"github.com/pkg/errors"
"github.com/uniplaces/logrus"
"github.com/pkg/errors"
)

// defines which levels log stack trace
Expand All @@ -28,8 +28,8 @@ type stackTracer interface {
}

const (
stackTraceKey = "stack_trace"
stackTraceFormat = "%s:%d"
stackTraceKey = "stack_trace"
stackTraceFormat = "%s:%d"
stackTraceErrorPkgFormat = "%+v"
)

Expand All @@ -44,10 +44,7 @@ func NewLogrusLogger(level string, writer io.Writer) logrusLogger {
}

instance.Formatter = &logrus.JSONFormatter{
EnableIntLogLevels: true,
FieldMap: logrus.FieldMap{
logrus.FieldKeyMsg: "short_message",
},
EnableIntLogLevels:true,
}
instance.Level = logrusLevel
instance.Out = writer
Expand Down
1 change: 0 additions & 1 deletion logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,4 @@ func addMandatoryDefaultFields() {
AddDefaultField("app-id", os.Getenv("APPID"), false)
AddDefaultField("env", os.Getenv("GOENV"), false)
AddDefaultField("git-hash", os.Getenv("GITHASH"), false)
AddDefaultField("version", "1.1", false)
}
3 changes: 1 addition & 2 deletions logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ func TestLogWithDefaultFields(t *testing.T) {
"foo": "bar",
"test-context-field": "context_field_value",
},
"version": "1.1",
}

builder := Builder()
Expand Down Expand Up @@ -95,7 +94,7 @@ func TestLogWithFieldsAndStacktrace(t *testing.T) {
// test stack trace strings
assert.Contains(t, buffer.String(), "github.com/uniplaces/go-logger.justToShowUpInStackTrace")
assert.Contains(t, buffer.String(), "github.com/uniplaces/go-logger.TestLogWithFieldsAndStacktrace")
assert.Contains(t, buffer.String(), "github.com/uniplaces/go-logger/logger_test.go:123")
assert.Contains(t, buffer.String(), "github.com/uniplaces/go-logger/logger_test.go:122")

resetInstance()
}
Expand Down

0 comments on commit 2554775

Please sign in to comment.