func()

in logsapi/event.go [79:103]


func (lc *Client) FlushData(
	ctx context.Context,
	requestID string,
	invokedFnArn string,
	dataChan chan []byte,
	isShutdown bool,
) {
	lc.logger.Infof("flushing %d buffered logs", len(lc.logsChannel))
	for {
		select {
		case logEvent := <-lc.logsChannel:
			if shouldExit := lc.handleEvent(ctx, logEvent, requestID, invokedFnArn, dataChan, isShutdown); shouldExit {
				return
			}
		case <-ctx.Done():
			lc.logger.Debug("Current invocation over. Interrupting logs flushing")
			return
		default:
			if len(lc.logsChannel) == 0 {
				lc.logger.Debug("Flush ended for logs - no data in buffer")
				return
			}
		}
	}
}