Esempio n. 1
0
 def test_get_console_logger(self):
     logger = log.get_logger("route", "name", "DEBUG", "LOG_LOCAL0", True)
     self.assertEquals(logger.logger, getLogger("route"))
     self.assertEquals(logger.server, "name")
     self.assertEquals(logger.getEffectiveLevel(), DEBUG)
     found = False
     for handler in logger.logger.handlers:
         if isinstance(handler, StreamHandler):
             found = True
             break
     self.assertTrue(found)
     self.assertTrue(handler.stream, stdout)
Esempio n. 2
0
    def test_get_logger(self):
        logger = log.get_logger("route", "name", "DEBUG", "LOG_LOCAL0", False)
        self.assertEquals(logger.logger, getLogger("route"))
        self.assertEquals(logger.server, "name")
        self.assertEquals(logger.getEffectiveLevel(), DEBUG)
        found = False
        for handler in logger.logger.handlers:
            if isinstance(handler, SysLogHandler):
                found = True
                break
        self.assertTrue(found)
        self.assertTrue(handler.facility, SysLogHandler.LOG_LOCAL0)

        logger = log.get_logger("route", "name2", "INFO", "LOG_LOCAL1", False)
        self.assertEquals(logger.logger, getLogger("route"))
        self.assertEquals(logger.server, "name2")
        self.assertEquals(logger.getEffectiveLevel(), INFO)
        found = False
        for handler in logger.logger.handlers:
            if isinstance(handler, SysLogHandler):
                found = True
                break
        self.assertTrue(found)
        self.assertTrue(handler.facility, SysLogHandler.LOG_LOCAL1)
Esempio n. 3
0
    def test_get_logger(self):
        logger = log.get_logger('route', 'name', 'DEBUG', 'LOG_LOCAL0', False)
        self.assertEqual(logger.logger, getLogger('route'))
        self.assertEqual(logger.server, 'name')
        self.assertEqual(logger.getEffectiveLevel(), DEBUG)
        found = False
        for handler in logger.logger.handlers:
            if isinstance(handler, SysLogHandler):
                found = True
                break
        self.assertTrue(found)
        self.assertTrue(handler.facility, SysLogHandler.LOG_LOCAL0)

        logger = log.get_logger('route', 'name2', 'INFO', 'LOG_LOCAL1', False)
        self.assertEqual(logger.logger, getLogger('route'))
        self.assertEqual(logger.server, 'name2')
        self.assertEqual(logger.getEffectiveLevel(), INFO)
        found = False
        for handler in logger.logger.handlers:
            if isinstance(handler, SysLogHandler):
                found = True
                break
        self.assertTrue(found)
        self.assertTrue(handler.facility, SysLogHandler.LOG_LOCAL1)