mirror of
https://github.com/rwinkhart/go-winio.git
synced 2026-09-05 08:37:37 -04:00
Merge pull request #138 from microsoft/etw-write-error
etwlogrus: Ignore error from ETW WriteEvent
This commit is contained in:
@@ -88,10 +88,17 @@ func (h *Hook) Fire(e *logrus.Entry) error {
|
|||||||
fields = append(fields, etw.SmartField(logrus.ErrorKey, e.Data[logrus.ErrorKey]))
|
fields = append(fields, etw.SmartField(logrus.ErrorKey, e.Data[logrus.ErrorKey]))
|
||||||
}
|
}
|
||||||
|
|
||||||
return h.provider.WriteEvent(
|
// Firing an ETW event is essentially best effort, as the event write can
|
||||||
|
// fail for reasons completely out of the control of the event writer (such
|
||||||
|
// as a session listening for the event having no available space in its
|
||||||
|
// buffers). Therefore, we don't return the error from WriteEvent, as it is
|
||||||
|
// just noise in many cases.
|
||||||
|
h.provider.WriteEvent(
|
||||||
"LogrusEntry",
|
"LogrusEntry",
|
||||||
etw.WithEventOpts(etw.WithLevel(level)),
|
etw.WithEventOpts(etw.WithLevel(level)),
|
||||||
fields)
|
fields)
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close cleans up the hook and closes the ETW provider. If the provder was
|
// Close cleans up the hook and closes the ETW provider. If the provder was
|
||||||
|
|||||||
Reference in New Issue
Block a user