Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions array.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,3 +318,20 @@ func (nums uintptrs) MarshalLogArray(arr zapcore.ArrayEncoder) error {
}
return nil
}

// runes is an array helper for slices of rune, mirroring the existing
// typed array helpers in this file.
type runes []rune

func (rs runes) MarshalLogArray(arr zapcore.ArrayEncoder) error {
for i := range rs {
arr.AppendInt32(int32(rs[i]))
}
return nil
}

// Runes constructs a field that carries a slice of runes.
func Runes(key string, rs []rune) Field {
return Array(key, runes(rs))
}

Loading