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

Method flush

zapio/writer.go:138–143  ·  view source on GitHub ↗

flush flushes the buffered data to the logger, allowing empty messages only if the bool is set.

(allowEmpty bool)

Source from the content-addressed store, hash-verified

136// flush flushes the buffered data to the logger, allowing empty messages only
137// if the bool is set.
138func (w *Writer) flush(allowEmpty bool) {
139 if allowEmpty || w.buff.Len() > 0 {
140 w.log(w.buff.Bytes())
141 }
142 w.buff.Reset()
143}
144
145func (w *Writer) log(b []byte) {
146 if ce := w.Log.Check(w.Level, string(b)); ce != nil {

Callers 2

writeLineMethod · 0.95
SyncMethod · 0.95

Calls 4

logMethod · 0.95
BytesMethod · 0.80
ResetMethod · 0.80
LenMethod · 0.45

Tested by

no test coverage detected