Пример #1
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.get_level() == 10
Пример #2
0
 def test_set_level_from_log(self):
     w = Wryte(name=str(uuid.uuid4()))
     assert w.get_level() == logging.INFO
     w.log('error', 'My Error', _set_level='debug')
     assert w.get_level() == logging.DEBUG
Пример #3
0
 def test_set_level(self):
     w = Wryte(name=str(uuid.uuid4()))
     assert w.get_level() == logging.INFO
     w.set_level('debug')
     assert w.get_level() == logging.DEBUG