(arr zapcore.ArrayEncoder)
| 51 | type errArray []error |
| 52 | |
| 53 | func (errs errArray) MarshalLogArray(arr zapcore.ArrayEncoder) error { |
| 54 | for i := range errs { |
| 55 | if errs[i] == nil { |
| 56 | continue |
| 57 | } |
| 58 | // To represent each error as an object with an "error" attribute and |
| 59 | // potentially an "errorVerbose" attribute, we need to wrap it in a |
| 60 | // type that implements LogObjectMarshaler. To prevent this from |
| 61 | // allocating, pool the wrapper type. |
| 62 | elem := _errArrayElemPool.Get() |
| 63 | elem.error = errs[i] |
| 64 | err := arr.AppendObject(elem) |
| 65 | elem.error = nil |
| 66 | _errArrayElemPool.Put(elem) |
| 67 | if err != nil { |
| 68 | return err |
| 69 | } |
| 70 | } |
| 71 | return nil |
| 72 | } |
| 73 | |
| 74 | type errArrayElem struct { |
| 75 | error |
nothing calls this directly
no test coverage detected