New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add etw UnicodeStringField #211
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,14 @@ func JSONStringField(name string, value string) FieldOpt { | |
} | ||
} | ||
|
||
// UnicodeStringField adds a single UTF-16 string field to the event. | ||
func UnicodeStringField(name string, value string) FieldOpt { | ||
return func(em *eventMetadata, ed *eventData) { | ||
em.writeField(name, inTypeUnicodeString, outTypeString, 0) | ||
helsaawy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ed.writeUnicodeString(value) | ||
} | ||
} | ||
|
||
// StringArray adds an array of string to the event. | ||
func StringArray(name string, values []string) FieldOpt { | ||
return func(em *eventMetadata, ed *eventData) { | ||
|
@@ -75,6 +83,17 @@ func StringArray(name string, values []string) FieldOpt { | |
} | ||
} | ||
|
||
// UnicodeStringArray adds an array of UTF-16 strings to the event. | ||
func UnicodeStringArray(name string, values []string) FieldOpt { | ||
return func(em *eventMetadata, ed *eventData) { | ||
em.writeArray(name, inTypeUnicodeString, outTypeString, 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want the out type here? It looks like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please see below. |
||
ed.writeUint16(uint16(len(values))) | ||
for _, v := range values { | ||
ed.writeUnicodeString(v) | ||
} | ||
} | ||
} | ||
|
||
// IntField adds a single int field to the event. | ||
func IntField(name string, value int) FieldOpt { | ||
switch unsafe.Sizeof(value) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to suppress the linter on error checking (or you can add a
//nolint:errcheck
directive)