Add ETW support for arrays

This commit is contained in:
Kevin Parsons
2018-12-21 10:10:06 -08:00
parent 50cf0baa2f
commit 7c26c75173
3 changed files with 46 additions and 5 deletions
+8
View File
@@ -2,6 +2,7 @@ package etw
import (
"bytes"
"encoding/binary"
)
// EventData maintains a buffer which builds up the data for an ETW event. It
@@ -20,3 +21,10 @@ func (ed *EventData) AddString(data string) {
ed.buffer.WriteString(data)
ed.buffer.WriteByte(0)
}
// This is mostly added for testing purposes, and will be removed later, as we
// shouldn't take a dependency on binary.Write knowing how to marshal values
// correctly for TraceLogging.
func (ed *EventData) AddSimple(data interface{}) {
binary.Write(&ed.buffer, binary.LittleEndian, data)
}