Python logging.setLogRecordFactory() Examples

The following are code examples for showing how to use logging.setLogRecordFactory(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the exmaples you don't like. You can also save this page to your account.

Example 1
Project: zippy   Author: securesystemslab   File: test_logging.py    (license) View Source Project 4 votes vote down vote up
def tearDown(self):
        self.root_logger.removeFilter(self.filter)
        BaseTest.tearDown(self)
        logging.setLogRecordFactory(self.orig_factory) 
Example 2
Project: zippy   Author: securesystemslab   File: test_logging.py    (license) View Source Project 4 votes vote down vote up
def test_logrecord_class(self):
        self.assertRaises(TypeError, self.root_logger.warning,
                          self.next_message())
        logging.setLogRecordFactory(DerivedLogRecord)
        self.root_logger.error(self.next_message())
        self.assert_log_lines([
           ('root', 'ERROR', '2'),
        ]) 
Example 3
Project: web_ctp   Author: molebot   File: test_logging.py    (license) View Source Project 4 votes vote down vote up
def test_set_log_record_factory(self):
        man = logging.Manager(None)
        expected = object()
        man.setLogRecordFactory(expected)
        self.assertEqual(man.logRecordFactory, expected) 
Example 4
Project: web_ctp   Author: molebot   File: test_logging.py    (license) View Source Project 4 votes vote down vote up
def tearDown(self):
        self.root_logger.removeFilter(self.filter)
        BaseTest.tearDown(self)
        logging.setLogRecordFactory(self.orig_factory) 
Example 5
Project: web_ctp   Author: molebot   File: test_logging.py    (license) View Source Project 4 votes vote down vote up
def test_logrecord_class(self):
        self.assertRaises(TypeError, self.root_logger.warning,
                          self.next_message())
        logging.setLogRecordFactory(DerivedLogRecord)
        self.root_logger.error(self.next_message())
        self.assert_log_lines([
           ('root', 'ERROR', '2'),
        ]) 
Example 6
Project: ouroboros   Author: pybee   File: test_logging.py    (license) View Source Project 4 votes vote down vote up
def test_set_log_record_factory(self):
        man = logging.Manager(None)
        expected = object()
        man.setLogRecordFactory(expected)
        self.assertEqual(man.logRecordFactory, expected) 
Example 7
Project: ouroboros   Author: pybee   File: test_logging.py    (license) View Source Project 4 votes vote down vote up
def tearDown(self):
        self.root_logger.removeFilter(self.filter)
        BaseTest.tearDown(self)
        logging.setLogRecordFactory(self.orig_factory) 
Example 8
Project: ouroboros   Author: pybee   File: test_logging.py    (license) View Source Project 4 votes vote down vote up
def test_logrecord_class(self):
        self.assertRaises(TypeError, self.root_logger.warning,
                          self.next_message())
        logging.setLogRecordFactory(DerivedLogRecord)
        self.root_logger.error(self.next_message())
        self.assert_log_lines([
           ('root', 'ERROR', '2'),
        ]) 
Example 9
Project: kbe_server   Author: xiaohaoppy   File: test_logging.py    (license) View Source Project 4 votes vote down vote up
def test_set_log_record_factory(self):
        man = logging.Manager(None)
        expected = object()
        man.setLogRecordFactory(expected)
        self.assertEqual(man.logRecordFactory, expected) 
Example 10
Project: kbe_server   Author: xiaohaoppy   File: test_logging.py    (license) View Source Project 4 votes vote down vote up
def tearDown(self):
        self.root_logger.removeFilter(self.filter)
        BaseTest.tearDown(self)
        logging.setLogRecordFactory(self.orig_factory) 
Example 11
Project: kbe_server   Author: xiaohaoppy   File: test_logging.py    (license) View Source Project 4 votes vote down vote up
def test_logrecord_class(self):
        self.assertRaises(TypeError, self.root_logger.warning,
                          self.next_message())
        logging.setLogRecordFactory(DerivedLogRecord)
        self.root_logger.error(self.next_message())
        self.assert_log_lines([
           ('root', 'ERROR', '2'),
        ])