MCPcopy
hub / github.com/uber-go/zap / Before

Method Before

zapcore/entry.go:319–326  ·  view source on GitHub ↗

Before adds a pre-write hook that transforms the Entry and Fields before they are written to any registered Cores. Multiple hooks run in the order they were added. It's safe to call this on nil CheckedEntry references.

(ent Entry, hook CheckPreWriteHook)

Source from the content-addressed store, hash-verified

317// they are written to any registered Cores. Multiple hooks run in the order
318// they were added. It's safe to call this on nil CheckedEntry references.
319func (ce *CheckedEntry) Before(ent Entry, hook CheckPreWriteHook) *CheckedEntry {
320 if ce == nil {
321 ce = getCheckedEntry()
322 ce.Entry = ent
323 }
324 ce.before = append(ce.before, hook)
325 return ce
326}
327
328// After sets this CheckEntry's CheckWriteHook, which will be called after this
329// log entry has been written. It's safe to call this on nil CheckedEntry

Callers 3

TestCheckedEntryBeforeFunction · 0.95
TimeFunction · 0.80
AddMethod · 0.80

Calls 1

getCheckedEntryFunction · 0.85

Tested by 1

TestCheckedEntryBeforeFunction · 0.76