'Log levels.'

def test_levels(self):

    levelMapping = {None: py_logging.INFO, LogLevel.debug: py_logging.DEBUG, LogLevel.info: py_logging.INFO, LogLevel.warn: py_logging.WARNING, LogLevel.error: py_logging.ERROR, LogLevel.critical: py_logging.CRITICAL}
    events = []
    for (level, pyLevel) in levelMapping.items():
        event = {}
        if (level is not None):
            event['log_level'] = level
        event['py_levelno'] = int(pyLevel)
        events.append(event)
    (records, output) = self.logEvent(*events)
    self.assertEqual(len(records), len(levelMapping))
    for i in range(len(records)):
        self.assertEqual(records[i].levelno, events[i]['py_levelno'])
