Skip to content

Commit

Permalink
Merge pull request sirupsen#298 from dolmen/refactor-prefixFieldClashes
Browse files Browse the repository at this point in the history
formatter.go: simplify prefixFieldClashes(Fields)
  • Loading branch information
aybabtme committed Apr 16, 2016
2 parents ed4b7af + 12ea3a4 commit 881c9d3
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,15 @@ type Formatter interface {
// It's not exported because it's still using Data in an opinionated way. It's to
// avoid code duplication between the two default formatters.
func prefixFieldClashes(data Fields) {
_, ok := data["time"]
if ok {
data["fields.time"] = data["time"]
if t, ok := data["time"]; ok {
data["fields.time"] = t
}

_, ok = data["msg"]
if ok {
data["fields.msg"] = data["msg"]
if m, ok := data["msg"]; ok {
data["fields.msg"] = m
}

_, ok = data["level"]
if ok {
data["fields.level"] = data["level"]
if l, ok := data["level"]; ok {
data["fields.level"] = l
}
}

0 comments on commit 881c9d3

Please sign in to comment.