本文整理汇总了Python中msg_logger.MSGLogger.startRecording方法的典型用法代码示例。如果您正苦于以下问题:Python MSGLogger.startRecording方法的具体用法?Python MSGLogger.startRecording怎么用?Python MSGLogger.startRecording使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msg_logger.MSGLogger
的用法示例。
在下文中一共展示了MSGLogger.startRecording方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MSGLoggerTester
# 需要导入模块: from msg_logger import MSGLogger [as 别名]
# 或者: from msg_logger.MSGLogger import startRecording [as 别名]
class MSGLoggerTester(unittest.TestCase):
def setUp(self):
#print "Initializing logger."
self.logger = MSGLogger(__name__, level='DEBUG')
print 'logger level: %s' % self.logger.loggerLevel
def testInit(self):
self.logger.log('Testing init.',level='info')
self.assertIsNotNone(self.logger)
def testLogRecording(self):
self.logger.log('Testing log recording.','info')
msg = "Recording test."
self.logger.startRecording()
self.logger.log(msg, 'info')
self.logger.endRecording()
self.logger.log("This should not be logged.", 'info')
result = re.search(msg, self.logger.recording).group(0)
self.logger.log("recording result: %s" % self.logger.recording)
self.assertEqual(result, msg)
def testSilentLogging(self):
return
self.logger.log('Testing silent logging.','info')
msg = "Recording test."
self.logger.startRecording()
self.logger.log(msg, 'silent')
self.logger.endRecording()
self.assertEqual(self.logger.recording, '')
def testDebugLogging(self):
self.logger.log('Testing debug logging','DEBUG')
def testDoublingOfLoggingOutput(self):
self.logger.log('This is a test of doubling of logger output at the beginning of a test.')