code: func prepLogs(buf []byte) (json.RawMessage, int) {
  	b := make(json.RawMessage, 1, len(buf)+1)
  	b[0] = '['
  	b = append(b, buf...)
  	last := -1
  	for i := 1; i < len(b); i++ {
  		if b[i] == '\n' {
  			b[i] = ','
  			last = i
  		}
  	}
  	if last < 0 {
  		return emptyChunk, -1
  	}
  	b[last] = ']'
  	return b[:last+1], last - 1
  }
docs: // prepLogs creates a JSON array from the given log record buffer.
  // Returns the prepared array and the position of the last '\n'
  // character in the original buffer, or -1 if it doesn't contain any.