CreateArray creates an Array to be used with the Context.Array method. It preserves the stack, hooks, and context from the logger. Call usual field methods like Str, Int etc to add elements to this array and give it as argument the Context.Array method.
()
| 47 | // Call usual field methods like Str, Int etc to add elements to this |
| 48 | // array and give it as argument the Context.Array method. |
| 49 | func (c Context) CreateArray() *Array { |
| 50 | a := Arr() |
| 51 | a.stack = c.l.stack |
| 52 | a.ctx = c.l.ctx |
| 53 | a.ch = c.l.hooks |
| 54 | return a |
| 55 | } |
| 56 | |
| 57 | // Array adds the field key with an array to the event context. |
| 58 | // Use c.CreateArray() to create the array or pass a type that |