const _defaultBufferSize … const _defaultFlushInterval … type BufferedWriteSyncer … func (s *BufferedWriteSyncer) initialize() { … } // Write writes log data into buffer syncer directly, multiple Write calls will be batched, // and log data will be flushed to disk when the buffer is full or periodically. func (s *BufferedWriteSyncer) Write(bs []byte) (int, error) { … } // Sync flushes buffered log data into disk directly. func (s *BufferedWriteSyncer) Sync() error { … } // flushLoop flushes the buffer at the configured interval until Stop is // called. func (s *BufferedWriteSyncer) flushLoop() { … } // Stop closes the buffer, cleans up background goroutines, and flushes // remaining unwritten data. func (s *BufferedWriteSyncer) Stop() (err error) { … }