示例#1
0
文件: test.py 项目: A32/pycodemo
 def test_set_default(self):
     mlogging.set_default(format_string='%(message)s')
     name = 'option.set_default'
     log = mlogging.config(name=name, outputs=['screen'])
     # redirect stream to string io to capture
     log.handlers[0].stream = StringIO()
     log.warning('warning')
     log_output = log.handlers[0].stream.getvalue()
     msg_warning = get_linestring_split(log_output, 0)
     self.assertEqual(msg_warning[0:1], ['warning'])
示例#2
0
 def test_set_default(self):
     mlogging.set_default(format_string='%(message)s')
     name = 'option.set_default'
     log = mlogging.config(name=name, outputs=['screen'])
     # redirect stream to string io to capture
     log.handlers[0].stream = StringIO()
     log.warning('warning')
     log_output = log.handlers[0].stream.getvalue()
     msg_warning = get_linestring_split(log_output, 0)
     self.assertEqual(msg_warning[0:1], ['warning'])
示例#3
0
文件: test.py 项目: A32/pycodemo
 def tearDown(self):
     shutil.rmtree(self.local_root)
     mlogging.set_default(local_root=self.local_root_old)
示例#4
0
文件: test.py 项目: A32/pycodemo
 def setUp(self):
     self.local_root_old = mlogging.default_local_root
     self.local_root = gen_temp_dir()
     mlogging.set_default(local_root=self.local_root)
示例#5
0
 def tearDown(self):
     shutil.rmtree(self.local_root)
     mlogging.set_default(local_root=self.local_root_old)
示例#6
0
 def setUp(self):
     self.local_root_old = mlogging.default_local_root
     self.local_root = gen_temp_dir()
     mlogging.set_default(local_root=self.local_root)