コード例 #1
0
    def test_remove_handler(self):
        w = Wryte(name=str(uuid.uuid4()))
        assert len(w.list_handlers()) == 1
        assert w.list_handlers() == ['_console']

        w.remove_handler('_console')
        assert len(w.list_handlers()) == 0
        assert w.list_handlers() == []
コード例 #2
0
    def test_add_handler(self):
        w = Wryte(name=str(uuid.uuid4()), bare=True)
        assert len(w.list_handlers()) == 0

        name = w.add_handler(handler=logging.StreamHandler(sys.stdout),
                             name='_json',
                             formatter='json',
                             level='debug')

        assert len(w.list_handlers()) == 1
        assert w.list_handlers() == ['_json']
        assert name == '_json'
        assert w.logger.getEffectiveLevel() == 10
コード例 #3
0
 def test_add_handler_bad_level(self):
     w = Wryte(name=str(uuid.uuid4()), bare=True)
     w.add_handler(handler=logging.StreamHandler(sys.stdout),
                   name='_json',
                   formatter='json',
                   level='BOOBOO')
     assert len(w.list_handlers()) == 0
コード例 #4
0
 def test_remove_nonexisting_handler(self):
     w = Wryte(name=str(uuid.uuid4()))
     w.remove_handler('banana')
     assert len(w.list_handlers()) == 1
コード例 #5
0
 def test_list_handlers_no_handlers_configured(self):
     w = Wryte(name=str(uuid.uuid4()), bare=True)
     assert len(w.list_handlers()) == 0
     assert w.list_handlers() == []
コード例 #6
0
 def test_list_handlers(self):
     w = Wryte(name=str(uuid.uuid4()))
     assert len(w.list_handlers()) == 1
     assert w.list_handlers() == ['_console']
コード例 #7
0
 def test_bare_handler(self):
     w = Wryte(name=str(uuid.uuid4()), bare=True)
     assert len(w.list_handlers()) == 0