Fields is a helper function to use a map or slice to set fields using type assertion. Only map[string]interface{} and []interface{} are accepted. []interface{} must alternate string keys and arbitrary values, and extraneous ones are ignored.
(fields interface{})
| 170 | // Only map[string]interface{} and []interface{} are accepted. []interface{} must |
| 171 | // alternate string keys and arbitrary values, and extraneous ones are ignored. |
| 172 | func (e *Event) Fields(fields interface{}) *Event { |
| 173 | if e == nil { |
| 174 | return e |
| 175 | } |
| 176 | e.buf = appendFields(e.buf, fields, e.stack, e.ctx, e.ch) |
| 177 | return e |
| 178 | } |
| 179 | |
| 180 | // Dict adds the field key with a dict to the event context. |
| 181 | // Use e.CreateDict() to create the dictionary. |