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

Method initialize

zapcore/buffered_write_syncer.go:112–133  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

110}
111
112func (s *BufferedWriteSyncer) initialize() {
113 size := s.Size
114 if size == 0 {
115 size = _defaultBufferSize
116 }
117
118 flushInterval := s.FlushInterval
119 if flushInterval == 0 {
120 flushInterval = _defaultFlushInterval
121 }
122
123 if s.Clock == nil {
124 s.Clock = DefaultClock
125 }
126
127 s.ticker = s.Clock.NewTicker(flushInterval)
128 s.writer = bufio.NewWriterSize(s.WS, size)
129 s.stop = make(chan struct{})
130 s.done = make(chan struct{})
131 s.initialized = true
132 go s.flushLoop()
133}
134
135// Write writes log data into buffer syncer directly, multiple Write calls will be batched,
136// and log data will be flushed to disk when the buffer is full or periodically.

Callers 1

WriteMethod · 0.95

Calls 2

flushLoopMethod · 0.95
NewTickerMethod · 0.65

Tested by

no test coverage detected