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

Method Write

zapcore/core.go:94–110  ·  view source on GitHub ↗
(ent Entry, fields []Field)

Source from the content-addressed store, hash-verified

92}
93
94func (c *ioCore) Write(ent Entry, fields []Field) error {
95 buf, err := c.enc.EncodeEntry(ent, fields)
96 if err != nil {
97 return err
98 }
99 _, err = c.out.Write(buf.Bytes())
100 buf.Free()
101 if err != nil {
102 return err
103 }
104 if ent.Level > ErrorLevel {
105 // Since we may be crashing the program, sync the output.
106 // Ignore Sync errors, pending a clean solution to issue #370.
107 _ = c.Sync()
108 }
109 return nil
110}
111
112func (c *ioCore) Sync() error {
113 return c.out.Sync()

Callers

nothing calls this directly

Calls 5

SyncMethod · 0.95
BytesMethod · 0.80
EncodeEntryMethod · 0.65
WriteMethod · 0.65
FreeMethod · 0.45

Tested by

no test coverage detected