mirror of
https://github.com/rwinkhart/go-winio.git
synced 2026-09-05 16:47:31 -04:00
Separate ETW into low-level and high-level API
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package etw
|
||||
|
||||
// EventOpt defines the option function type that can be passed to
|
||||
// Provider.WriteEvent to specify general event options, such as level and
|
||||
// keyword.
|
||||
type EventOpt func(*EventDescriptor, *uint32)
|
||||
|
||||
// WithLevel specifies the level of the event to be written.
|
||||
func WithLevel(level Level) EventOpt {
|
||||
return func(descriptor *EventDescriptor, tags *uint32) {
|
||||
descriptor.Level = level
|
||||
}
|
||||
}
|
||||
|
||||
// WithKeyword specifies the keywords of the event to be written. Multiple uses
|
||||
// of this option are OR'd together.
|
||||
func WithKeyword(keyword uint64) EventOpt {
|
||||
return func(descriptor *EventDescriptor, tags *uint32) {
|
||||
descriptor.Keyword |= keyword
|
||||
}
|
||||
}
|
||||
|
||||
// WithTags specifies the tags of the event to be written. Tags is a 28-bit
|
||||
// value (top 4 bits are ignored) which are interpreted by the event consumer.
|
||||
func WithTags(newTags uint32) EventOpt {
|
||||
return func(descriptor *EventDescriptor, tags *uint32) {
|
||||
*tags |= newTags
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user