Ejemplo n.º 1
0
 def logger(self):
     """
     Backwards compatible logger property
     :return: Logger instance
     """
     if not self._logger:
         self._logger = Logger()
     return self._logger
Ejemplo n.º 2
0
class TestSession(unittest.TestCase):
    def setUp(self):
        self.output = StringIO()
        self.manager = Logger()
        self.manager.set_output(self.output)
        self.logger = self.manager.new_module("test")

    def test_level(self):
        self.logger.debug("test")
        self.assertEqual(self.output.tell(), 0)
        self.manager.set_level("debug")
        self.logger.debug("test")
        self.assertNotEqual(self.output.tell(), 0)

    def test_output(self):
        self.manager.set_level("debug")
        self.logger.debug("test")
        self.assertEqual(self.output.getvalue(), "[test][debug] test\n")
Ejemplo n.º 3
0
 def setUp(self):
     self.output = StringIO()
     self.manager = Logger()
     self.manager.set_output(self.output)
     self.logger = self.manager.new_module("test")