MCPcopy Index your code
hub / github.com/python/cpython / test_manager_loggerclass

Method test_manager_loggerclass

Lib/test/test_logging.py:4238–4252  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4236
4237class ManagerTest(BaseTest):
4238 def test_manager_loggerclass(self):
4239 logged = []
4240
4241 class MyLogger(logging.Logger):
4242 def _log(self, level, msg, args, exc_info=None, extra=None):
4243 logged.append(msg)
4244
4245 man = logging.Manager(None)
4246 self.assertRaises(TypeError, man.setLoggerClass, int)
4247 man.setLoggerClass(MyLogger)
4248 logger = man.getLogger('test')
4249 logger.warning('should appear in logged')
4250 logging.warning('should not appear in logged')
4251
4252 self.assertEqual(logged, ['should appear in logged'])
4253
4254 def test_set_log_record_factory(self):
4255 man = logging.Manager(None)

Callers

nothing calls this directly

Calls 6

setLoggerClassMethod · 0.95
getLoggerMethod · 0.95
ManagerMethod · 0.80
assertRaisesMethod · 0.45
warningMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected