...
1
2
3
4 package etw
5
6 import (
7 "github.com/Microsoft/go-winio/pkg/guid"
8 )
9
10 type eventOptions struct {
11 descriptor *eventDescriptor
12 activityID guid.GUID
13 relatedActivityID guid.GUID
14 tags uint32
15 }
16
17
18
19
20 type EventOpt func(options *eventOptions)
21
22
23 func WithEventOpts(opts ...EventOpt) []EventOpt {
24 return opts
25 }
26
27
28 func WithLevel(level Level) EventOpt {
29 return func(options *eventOptions) {
30 options.descriptor.level = level
31 }
32 }
33
34
35
36 func WithKeyword(keyword uint64) EventOpt {
37 return func(options *eventOptions) {
38 options.descriptor.keyword |= keyword
39 }
40 }
41
42
43 func WithChannel(channel Channel) EventOpt {
44 return func(options *eventOptions) {
45 options.descriptor.channel = channel
46 }
47 }
48
49
50 func WithOpcode(opcode Opcode) EventOpt {
51 return func(options *eventOptions) {
52 options.descriptor.opcode = opcode
53 }
54 }
55
56
57
58 func WithTags(newTags uint32) EventOpt {
59 return func(options *eventOptions) {
60 options.tags |= newTags
61 }
62 }
63
64
65 func WithActivityID(activityID guid.GUID) EventOpt {
66 return func(options *eventOptions) {
67 options.activityID = activityID
68 }
69 }
70
71
72 func WithRelatedActivityID(activityID guid.GUID) EventOpt {
73 return func(options *eventOptions) {
74 options.relatedActivityID = activityID
75 }
76 }
77
View as plain text