'Returns the mocked logger and stderr output.'

def _test_common(self, error_type, debug):

    mock_err = six.StringIO()
    try:
        raise error_type(self.error_msg)
    except BaseException:
        exc_info = sys.exc_info()
        with mock.patch('certbot.log.logger') as mock_logger:
            with mock.patch('certbot.log.sys.stderr', mock_err):
                try:
                    self._call(debug=debug, log_path=self.log_path, *exc_info)
                except SystemExit as exit_err:
                    mock_err.write(str(exit_err))
                else:
                    self.fail('SystemExit    not    raised.')
    output = mock_err.getvalue()
    return (mock_logger, output)
