Skip to content

Commit

Permalink
formatter.go: simplify prefixFieldClashes(Fields)
Browse files Browse the repository at this point in the history
  • Loading branch information
dolmen committed Nov 21, 2015
1 parent a22723f commit 12ea3a4
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 12ea3a4

Please sign in to comment.