etwlogrus: Pass through entry time as ETW field

Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
This commit is contained in:
Kevin Parsons
2019-06-25 10:36:45 -07:00
parent 12afdbf8b8
commit 09baa54393
+3 -2
View File
@@ -78,9 +78,10 @@ func (h *Hook) Fire(e *logrus.Entry) error {
}
sort.Strings(names)
// Reserve extra space for the message field.
fields := make([]etw.FieldOpt, 0, len(e.Data)+1)
// Reserve extra space for the message and time fields.
fields := make([]etw.FieldOpt, 0, len(e.Data)+2)
fields = append(fields, etw.StringField("Message", e.Message))
fields = append(fields, etw.Time("Time", e.Time))
for _, k := range names {
fields = append(fields, etw.SmartField(k, e.Data[k]))
}