Update json_formatter.go

If Data is empty, ignore the writing of Key
This commit is contained in:
simon 2021-03-11 09:20:33 +08:00 committed by GitHub
parent fe9e9fcbba
commit 49b11fd3f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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