Array adds the field key with an array to the event context. Use e.CreateArray() to create the array or pass a type that implement the LogArrayMarshaler interface.
(key string, arr LogArrayMarshaler)
| 227 | // Use e.CreateArray() to create the array or pass a type that |
| 228 | // implement the LogArrayMarshaler interface. |
| 229 | func (e *Event) Array(key string, arr LogArrayMarshaler) *Event { |
| 230 | if e == nil { |
| 231 | return e |
| 232 | } |
| 233 | e.buf = enc.AppendKey(e.buf, key) |
| 234 | var a *Array |
| 235 | if aa, ok := arr.(*Array); ok { |
| 236 | a = aa |
| 237 | } else { |
| 238 | a = e.CreateArray() |
| 239 | arr.MarshalZerologArray(a) |
| 240 | } |
| 241 | e.buf = a.write(e.buf) |
| 242 | return e |
| 243 | } |
| 244 | |
| 245 | func (e *Event) appendObject(obj LogObjectMarshaler) { |
| 246 | e.buf = enc.AppendBeginMarker(e.buf) |