def commit(self, client=None):
        if client is None:
            client = self.client

        data = {
            'logName': self.logger.path,
            'resource': {'type': 'global'},
        }
        if self.logger.labels is not None:
            data['labels'] = self.logger.labels

        entries = data['entries'] = []
        for entry_type, entry, labels, iid, severity, http_req in self.entries:
            if entry_type == 'text':
                info = {'textPayload': entry}
            elif entry_type == 'struct':
                info = {'jsonPayload': entry}
            elif entry_type == 'proto':
                as_json_str = MessageToJson(entry)
                as_json = json.loads(as_json_str)
                info = {'protoPayload': as_json}
            else:
                raise ValueError('Unknown entry type: %s' % (entry_type,))
            if labels is not None:
                info['labels'] = labels
            if iid is not None:
                info['insertId'] = iid
            if severity is not None:
                info['severity'] = severity
            if http_req is not None:
                info['httpRequest'] = http_req
            entries.append(info)

        client.connection.api_request(
            method='POST', path='/entries:write', data=data)
        del self.entries[:]
Send saved log entries as a single API call.
dataset/ETHPy150Open GoogleCloudPlatform/gcloud-python/gcloud/logging/logger.py/Batch.commit