'Clean the logs list by deleting finished items.
By default, only delete WARNING message.
If critical = True, also delete CRITICAL message.'

def clean(self, critical=False):

    clean_logs_list = []
    while (self.len() > 0):
        item = self.logs_list.pop()
        if ((item[1] < 0) or ((not critical) and item[2].startswith('CRITICAL'))):
            clean_logs_list.insert(0, item)
    self.logs_list = clean_logs_list
    return self.len()
