forked from mirror/logrus
formatter/json: fix possible race
This commit is contained in:
parent
092eda23b5
commit
f1addc2972
|
@ -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()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue