code: func (l *logStream) processEvent(batch *eventBatch, bytes []byte, timestamp int64) {
  	for len(bytes) > 0 {
  		// Split line length so it does not exceed the maximum
  		splitOffset, lineBytes := findValidSplit(string(bytes), maximumBytesPerEvent)
  		line := bytes[:splitOffset]
  		event := wrappedEvent{
  			inputLogEvent: &cloudwatchlogs.InputLogEvent{
  				Message:   aws.String(string(line)),
  				Timestamp: aws.Int64(timestamp),
  			},
  			insertOrder: batch.count(),
  		}
  
  		added := batch.add(event, lineBytes)
  		if added {
  			bytes = bytes[splitOffset:]
  		} else {
  			l.publishBatch(batch)
  			batch.reset()
  		}
  	}
  }
docs: // processEvent processes log events that are ready for submission to CloudWatch
  // logs.  Batching is performed on time- and size-bases.  Time-based batching
  // occurs at a 5 second interval (defined in the batchPublishFrequency const).
  // Size-based batching is performed on the maximum number of events per batch
  // (defined in maximumLogEventsPerPut) and the maximum number of total bytes in a
  // batch (defined in maximumBytesPerPut).  Log messages are split by the maximum
  // bytes per event (defined in maximumBytesPerEvent).  There is a fixed per-event
  // byte overhead (defined in perEventBytes) which is accounted for in split- and
  // batch-calculations.  Because the events are interpreted as UTF-8 encoded
  // Unicode, invalid UTF-8 byte sequences are replaced with the Unicode
  // replacement character (U+FFFD), which is a 3-byte sequence in UTF-8.  To
  // compensate for that and to avoid splitting valid UTF-8 characters into
  // invalid byte sequences, we calculate the length of each event assuming that
  // this replacement happens.