diff --git a/array.go b/array.go index 5be3704..1973545 100644 --- a/array.go +++ b/array.go @@ -318,3 +318,22 @@ 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)) +} + +// BUILD_BREAK references an undefined identifier and fails `go build`. +var _ = undefinedBuildBreakSymbol