INNER CODE UNIT · Go
func
boz/kail · buffer.go:20
func (b *_buffer) process(log []byte) []Event {
var events []Event
for end := bytes.IndexRune(log, '\n'); end >= 0 && len(log) > 0; end = bytes.IndexRune(log, '\n') {
var ebuf []byte
if plen := b.prev.Len(); plen > 0 {
ebuf = make([]byte, plen+end)
copy(ebuf, b.prev.Bytes())
copy(ebuf[plen:], log[:end])
b.prev.Reset()
} else {
ebuf = make([]byte, end)
copy(ebuf, log[:end])
}
events = append(events, newEvent(b.source, ebuf))