MCPcopy
hub / github.com/rs/zerolog / putEvent

Function putEvent

event.go:34–54  ·  view source on GitHub ↗
(e *Event)

Source from the content-addressed store, hash-verified

32}
33
34func 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.

Callers 8

writeMethod · 0.85
DictMethod · 0.85
DictMethod · 0.85
appendObjectFunction · 0.85
DictMethod · 0.85
ObjectMethod · 0.85
ObjectsMethod · 0.85
EmbedObjectMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected