Skip to content
This repository was archived by the owner on Nov 21, 2023. It is now read-only.

Commit b5464fe

Browse files
improved fields in GelfOutput
1 parent 41a316e commit b5464fe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

gelfoutput/gelfoutput.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (g *GelfOutput) Log(log *xlog.Log) {
8383
TimeUnix: float64(log.Time.UnixNano()) / float64(time.Second),
8484
Level: level,
8585
Facility: g.opts.Facility,
86-
Extra: make(map[string]interface{}),
86+
Extra: make(map[string]interface{}, 128+2*len(log.Fields)),
8787
}
8888
msg.Extra["severity"] = fmt.Sprintf("%s", log.Severity)
8989
msg.Extra["verbosity"] = int(log.Verbosity)
@@ -102,7 +102,8 @@ func (g *GelfOutput) Log(log *xlog.Log) {
102102
}
103103
for i := range log.Fields {
104104
field := &log.Fields[i]
105-
msg.Extra[fmt.Sprintf("%10.0d_%s", i, field.Key)] = field.Value
105+
msg.Extra[fmt.Sprintf("%3.3d_%s", i, field.Key)] = field.Value
106+
msg.Extra[fmt.Sprintf("_%s", field.Key)] = field.Value
106107
}
107108
g.writeMessage(msg)
108109
}

0 commit comments

Comments
 (0)