(e *Event)
| 32 | } |
| 33 | |
| 34 | func putEvent(e *Event) { |
| 35 | // prevent any subsequent use of the Event contextual state and truncate the buffer |
| 36 | e.w = nil |
| 37 | e.done = nil |
| 38 | e.stack = false |
| 39 | e.ch = nil |
| 40 | e.skipFrame = 0 |
| 41 | e.ctx = nil |
| 42 | e.buf = e.buf[:0] |
| 43 | |
| 44 | // Proper usage of a sync.Pool requires each entry to have approximately |
| 45 | // the same memory cost. To obtain this property when the stored type |
| 46 | // contains a variably-sized buffer, we add a hard limit on the maximum buffer |
| 47 | // to place back in the pool. |
| 48 | // |
| 49 | // See https://golang.org/issue/23199 |
| 50 | const maxSize = 1 << 16 // 64KiB |
| 51 | if cap(e.buf) <= maxSize { |
| 52 | eventPool.Put(e) |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // LogObjectMarshaler provides a strongly-typed and encoding-agnostic interface |
| 57 | // to be implemented by types used with Event/Context's Object methods. |
no outgoing calls
no test coverage detected