formatter/json: fix possible race
This commit is contained in:
+4
-3
@@ -24,11 +24,12 @@ func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
prefixFieldClashes(data)
|
prefixFieldClashes(data)
|
||||||
|
|
||||||
if f.TimestampFormat == "" {
|
timestampFormat := f.TimestampFormat
|
||||||
f.TimestampFormat = DefaultTimestampFormat
|
if timestampFormat == "" {
|
||||||
|
timestampFormat = DefaultTimestampFormat
|
||||||
}
|
}
|
||||||
|
|
||||||
data["time"] = entry.Time.Format(f.TimestampFormat)
|
data["time"] = entry.Time.Format(timestampFormat)
|
||||||
data["msg"] = entry.Message
|
data["msg"] = entry.Message
|
||||||
data["level"] = entry.Level.String()
|
data["level"] = entry.Level.String()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user