예제 #1
0
 def __exit__(self, *args):
     self.extend(self._stringio.getvalue().splitlines())
     del self._stringio  # free up some memory
     sys.stdout = self._stdout
     LOG.init()
예제 #2
0
 def __enter__(self):
     self._stdout = sys.stdout
     sys.stdout = self._stringio = StringIO()
     LOG.init()
     return self