예제 #1
0
 def testWriteMarkInError(self):
     loggable = log.Loggable()
     log.setDebug("%d" % log.ERROR)
     log.addLogHandler(self.handler)
     marker = 'test'
     loggable.writeMarker(marker, log.ERROR)
     self.assertEqual(self.message, marker)
예제 #2
0
    def testSet(self):
        old = log.getLogSettings()
        log.setDebug('*:5')
        self.assertNotEqual(old, log.getLogSettings())

        log.setLogSettings(old)
        self.assertEqual(old, log.getLogSettings())
예제 #3
0
    def testSet(self):
        old = log.getLogSettings()
        log.setDebug('*:5')
        self.assertNotEqual(old, log.getLogSettings())

        log.setLogSettings(old)
        self.assertEqual(old, log.getLogSettings())
예제 #4
0
 def testWriteMarkInError(self):
     loggable = log.Loggable()
     log.setDebug("%d" % log.ERROR)
     log.addLogHandler(self.handler)
     marker = 'test'
     loggable.writeMarker(marker, log.ERROR)
     self.assertEqual(self.message, marker)
예제 #5
0
 def testWriteMarkInInfo(self):
     loggable = log.Loggable()
     log.setDebug("%d" % log.INFO)
     log.addLogHandler(self.handler)
     marker = 'test'
     loggable.writeMarker(marker, log.INFO)
     self.assertEquals(self.message, marker)
예제 #6
0
    def testFormatStrings(self):
        log.setDebug("testlog:%d" % log.INFO)
        log.addLimitedLogHandler(self.handler)

        self.tester.info("%d %s", 42, 'the answer')
        self.assertEqual(self.category, 'testlog')
        self.assertEqual(self.level, log.INFO)
        self.assertEqual(self.message, '42 the answer')
예제 #7
0
    def testFormatStrings(self):
        log.setDebug("testlog:%d" % log.INFO)
        log.addLimitedLogHandler(self.handler)

        self.tester.info("%d %s", 42, 'the answer')
        self.assertEqual(self.category, 'testlog')
        self.assertEqual(self.level, log.INFO)
        self.assertEqual(self.message, '42 the answer')
예제 #8
0
    def testLimitedError(self):
        log.setDebug("testlog:%d" % log.ERROR)
        log.addLimitedLogHandler(self.handler)

        self.tester.error("error")
        self.assertEqual(self.category, 'testlog')
        self.assertEqual(self.level, log.ERROR)
        self.assertEqual(self.message, 'error')
예제 #9
0
    def testLimitedError(self):
        log.setDebug("testlog:%d" % log.ERROR)
        log.addLimitedLogHandler(self.handler)

        self.tester.error("error")
        self.assertEqual(self.category, 'testlog')
        self.assertEqual(self.level, log.ERROR)
        self.assertEqual(self.message, 'error')
예제 #10
0
    def testLogHandler(self):
        log.setDebug("testlog:%d" % log.INFO)
        log.addLogHandler(self.handler)

        self.tester.log("visible")
        self.assertEqual(self.message, 'visible')

        self.tester.warning("also visible")
        self.assertEqual(self.message, 'also visible')
예제 #11
0
    def testLogHandler(self):
        log.setDebug("testlog:%d" % log.INFO)
        log.addLogHandler(self.handler)

        self.tester.log("visible")
        self.assertEqual(self.message, 'visible')

        self.tester.warning("also visible")
        self.assertEqual(self.message, 'also visible')
예제 #12
0
    def testLimitInvisible(self):
        log.setDebug("testlog:%d" % log.INFO)
        log.addLimitedLogHandler(self.handler)

        # log 2 we shouldn't get
        self.tester.log("not visible")
        self.assertFalse(self.category)
        self.assertFalse(self.level)
        self.assertFalse(self.message)

        self.tester.debug("not visible")
        self.assertFalse(self.category)
        self.assertFalse(self.level)
        self.assertFalse(self.message)
예제 #13
0
    def testLimitedVisible(self):
        log.setDebug("testlog:%d" % log.INFO)
        log.addLimitedLogHandler(self.handler)

        # log 3 we should get
        self.tester.info("visible")
        self.assertEqual(self.category, 'testlog')
        self.assertEqual(self.level, log.INFO)
        self.assertEqual(self.message, 'visible')

        self.tester.warning("also visible")
        self.assertEqual(self.category, 'testlog')
        self.assertEqual(self.level, log.WARN)
        self.assertEqual(self.message, 'also visible')
예제 #14
0
    def testLimitedVisible(self):
        log.setDebug("testlog:%d" % log.INFO)
        log.addLimitedLogHandler(self.handler)

        # log 3 we should get
        self.tester.info("visible")
        self.assertEqual(self.category, 'testlog')
        self.assertEqual(self.level, log.INFO)
        self.assertEqual(self.message, 'visible')

        self.tester.warning("also visible")
        self.assertEqual(self.category, 'testlog')
        self.assertEqual(self.level, log.WARN)
        self.assertEqual(self.message, 'also visible')
예제 #15
0
    def testLimitInvisible(self):
        log.setDebug("testlog:%d" % log.INFO)
        log.addLimitedLogHandler(self.handler)

        # log 2 we shouldn't get
        self.tester.log("not visible")
        self.assertFalse(self.category)
        self.assertFalse(self.level)
        self.assertFalse(self.message)

        self.tester.debug("not visible")
        self.assertFalse(self.category)
        self.assertFalse(self.level)
        self.assertFalse(self.message)
예제 #16
0
    def testLogHandlerLimitedLevels(self):
        log.setDebug("testlog:%d" % log.INFO)
        log.addLimitedLogHandler(self.handler)

        # now try debug and log again too
        log.setDebug("testlog:%d" % log.LOG)

        self.tester.debug("debug")
        self.assertEqual(self.category, 'testlog')
        self.assertEqual(self.level, log.DEBUG)
        self.assertEqual(self.message, 'debug')

        self.tester.log("log")
        self.assertEqual(self.category, 'testlog')
        self.assertEqual(self.level, log.LOG)
        self.assertEqual(self.message, 'log')
예제 #17
0
    def testLogHandlerLimitedLevels(self):
        log.setDebug("testlog:%d" % log.INFO)
        log.addLimitedLogHandler(self.handler)

        # now try debug and log again too
        log.setDebug("testlog:%d" % log.LOG)

        self.tester.debug("debug")
        self.assertEqual(self.category, 'testlog')
        self.assertEqual(self.level, log.DEBUG)
        self.assertEqual(self.message, 'debug')

        self.tester.log("log")
        self.assertEqual(self.category, 'testlog')
        self.assertEqual(self.level, log.LOG)
        self.assertEqual(self.message, 'log')
예제 #18
0
 def testSetDebug(self):
     log.setDebug(":5")
     log.setDebug("*")
     log.setDebug("5")
예제 #19
0
    def testOwnLogHandlerLimited(self):
        log.setDebug("testlog:%d" % log.INFO)
        log.addLogHandler(self.handler)

        self.tester.log("visible")
        self.assertEqual(self.message, 'override visible')
예제 #20
0
    def testOwnLogHandlerLimited(self):
        log.setDebug("testlog:%d" % log.INFO)
        log.addLogHandler(self.handler)

        self.tester.log("visible")
        self.assertEqual(self.message, 'override visible')
예제 #21
0
 def testSetDebug(self):
     log.setDebug(":5")
     log.setDebug("*")
     log.setDebug("5")