mirror of https://github.com/sirupsen/logrus.git
Update json_formatter.go
If Data is empty, ignore the writing of Key
This commit is contained in:
parent
fe9e9fcbba
commit
49b11fd3f7
|
@ -73,7 +73,7 @@ func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
|
|||
}
|
||||
}
|
||||
|
||||
if f.DataKey != "" {
|
||||
if f.DataKey != "" && len(data) > 0 {
|
||||
newData := make(Fields, 4)
|
||||
newData[f.DataKey] = data
|
||||
data = newData
|
||||
|
|
Loading…
Reference in New Issue