Adding to @GDP's answer
...
$columns = array('user_id', 'type', 'object', 'lvl', 'date');
$values = array();
foreach ($batch as $row) {
$array = array(
$row->user_id,
$db->quote($row->type),
$db->quote($row->object),
$db->quote($row->lvl),
$db->quote($row->date),
);
$values[] = implode(',', $array);
}
$query->insert($db->quoteName('#activity_log''#__activity_log'));
$query->columns($db->quoteName($columns));
$query->values($values);
$db->setQuery($query);
$result = $db->execute();...