From 12ea3a4f8ea6f137e300bf1c3aa2a63367809ae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Sat, 21 Nov 2015 17:51:52 +0100 Subject: [PATCH] formatter.go: simplify prefixFieldClashes(Fields) --- formatter.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/formatter.go b/formatter.go index 104d689..b5fbe93 100644 --- a/formatter.go +++ b/formatter.go @@ -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 } }