mirror of https://github.com/sirupsen/logrus.git
Merge pull request #346 from e-max/logstash_formatter_race
race in logstashformatter.go
This commit is contained in:
commit
ed4b7af3d4
|
@ -24,11 +24,13 @@ func (f *LogstashFormatter) Format(entry *logrus.Entry) ([]byte, error) {
|
||||||
|
|
||||||
fields["@version"] = 1
|
fields["@version"] = 1
|
||||||
|
|
||||||
if f.TimestampFormat == "" {
|
timeStampFormat := f.TimestampFormat
|
||||||
f.TimestampFormat = logrus.DefaultTimestampFormat
|
|
||||||
|
if timeStampFormat == "" {
|
||||||
|
timeStampFormat = logrus.DefaultTimestampFormat
|
||||||
}
|
}
|
||||||
|
|
||||||
fields["@timestamp"] = entry.Time.Format(f.TimestampFormat)
|
fields["@timestamp"] = entry.Time.Format(timeStampFormat)
|
||||||
|
|
||||||
// set message field
|
// set message field
|
||||||
v, ok := entry.Data["message"]
|
v, ok := entry.Data["message"]
|
||||||
|
|
Loading…
Reference in New Issue