

def testLoggingException(self):
    ' Logging example with exception '
    log = logging.getLogger('')
    log.setLevel(logging.DEBUG)
    log.addHandler(MongoHandler(self.collection))
    try:
        (1 / 0)
    except ZeroDivisionError:
        log.error('test zero division', exc_info=True)
    r = self.collection.find_one({
        'levelname': 'ERROR',
        'msg': 'test zero division',
    })
    self.assertTrue(self['exc_info'].startswith('Traceback'))

dataset/ETHPy150Open andreisavu/mongodb-log/tests/test_handler.py TestRootLoggerHandler.testLoggingException/VarMisuse@97/139 `r`->`self`