

def handle_post_log(self, handle, connection, match, data, hdr):
    ' Create log session\n        '
    status = calvinresponse.OK
    actors = []
    events = []
    if (data and ('user_id' in data)):
        user_id = data['user_id']
    else:
        user_id = calvinuuid.uuid('TRACE')
    if (user_id not in self.loggers):
        if (('actors' in data) and data['actors']):
            actors = data['actors']
        if ('events' in data):
            events = []
            for event in data['events']:
                if (event == 'actor_firing'):
                    events.append(self.LOG_ACTOR_FIRING)
                elif (event == 'action_result'):
                    events.append(self.LOG_ACTION_RESULT)
                elif (event == 'actor_new'):
                    events.append(self.LOG_ACTOR_NEW)
                elif (event == 'actor_destroy'):
                    events.append(self.LOG_ACTOR_DESTROY)
                elif (event == 'actor_migrate'):
                    connection.append(self.LOG_ACTOR_MIGRATE)
                elif (event == 'application_new'):
                    events.append(self.LOG_APPLICATION_NEW)
                elif (event == 'application_destroy'):
                    events.append(self.LOG_APPLICATION_DESTROY)
                else:
                    status = calvinresponse.BAD_REQUEST
                    break
        if (status == calvinresponse.OK):
            self.loggers[user_id] = Logger(actors=actors, events=events)
    else:
        status = calvinresponse.BAD_REQUEST
    self.send_response(handle, connection, (json.dumps({
        'user_id': user_id,
        'epoch_year': time.gmtime(0).tm_year,
    }) if (status == calvinresponse.OK) else None), status=status)

dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/runtime/north/calvincontrol.py CalvinControl.handle_post_log/VarMisuse@218/318 `events`->`connection`