mirror of
https://github.com/rwinkhart/go-winio.git
synced 2026-09-05 16:47:31 -04:00
Merge pull request #104 from kevpar/etw-nofields
Support ETW events with no data fields
This commit is contained in:
@@ -201,7 +201,15 @@ func (provider *Provider) WriteEvent(name string, eventOpts []EventOpt, fieldOpt
|
|||||||
opt(em, ed)
|
opt(em, ed)
|
||||||
}
|
}
|
||||||
|
|
||||||
return provider.WriteEventRaw(options.descriptor, nil, nil, [][]byte{em.Bytes()}, [][]byte{ed.Bytes()})
|
// Don't pass a data blob if there is no event data. There will always be
|
||||||
|
// event metadata (e.g. for the name) so we don't need to do this check for
|
||||||
|
// the metadata.
|
||||||
|
dataBlobs := [][]byte{}
|
||||||
|
if len(ed.Bytes()) > 0 {
|
||||||
|
dataBlobs = [][]byte{ed.Bytes()}
|
||||||
|
}
|
||||||
|
|
||||||
|
return provider.WriteEventRaw(options.descriptor, nil, nil, [][]byte{em.Bytes()}, dataBlobs)
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteEventRaw writes a single ETW event from the provider. This function is
|
// WriteEventRaw writes a single ETW event from the provider. This function is
|
||||||
|
|||||||
Reference in New Issue
Block a user