Object marshals an object that implement the LogObjectMarshaler interface.
(key string, obj LogObjectMarshaler)
| 250 | |
| 251 | // Object marshals an object that implement the LogObjectMarshaler interface. |
| 252 | func (e *Event) Object(key string, obj LogObjectMarshaler) *Event { |
| 253 | if e == nil { |
| 254 | return e |
| 255 | } |
| 256 | e.buf = enc.AppendKey(e.buf, key) |
| 257 | if obj == nil { |
| 258 | e.buf = enc.AppendNil(e.buf) |
| 259 | |
| 260 | return e |
| 261 | } |
| 262 | |
| 263 | e.appendObject(obj) |
| 264 | return e |
| 265 | } |
| 266 | |
| 267 | // Objects adds the field key with objs as an array of objects that |
| 268 | // implement the LogObjectMarshaler interface to the event. |