Though I googled and got a lot of result, but they are not what I want. My main code as below
def main:
start = datetime.now()
browser = webdriver.PhantomJS()
download()
browser.quit()
showTime()
def download:
for imageSecond in imageSeconds:
urlServer = imageSecond.get("src")
pathLocal = formatPath(downloadLocationPath, ntpath.basename(urlServer))
if not os.path.isfile(pathLocal):
ts.append(createNewDownloadThread(browser, urlServer, pathLocal))
else:
logger.info('Downloaded: {}'.format(urlServer + " -> " + pathLocal))
showTime()
for t in ts:
t.join()
def showTime:
end = datetime.now()
runtime = end - start
logger.info('Sta Time: {}'.format(start))
logger.info('End Time: {}'.format(end))
logger.info('Run Time: {}'.format(runtime))
sys.exit(0)
I got output as below
2017-02-27 09:42:12,817 - INFO - MainThread - Downloaded: https://secure-api.userlocal.jp
2017-02-27 09:42:12,833 - INFO - MainThread - Sta Time: 2017-02-27 09:41:43.895126
2017-02-27 09:42:12,833 - INFO - MainThread - End Time: 2017-02-27 09:42:12.833492
2017-02-27 09:42:12,833 - INFO - MainThread - Run Time: 0:00:28.938366
2017-02-27 09:42:12,849 - INFO - Thread-323 - Download: https://secure-api.userlocal.jp
2017-02-27 09:42:12,849 - INFO - Thread-324 - Download: https://secure-api.userlocal.jp
But what I want to output as below, what can I do?
2017-02-27 09:42:12,817 - INFO - MainThread - Downloaded: https://secure-api.userlocal.jp
2017-02-27 09:42:12,849 - INFO - Thread-323 - Download: https://secure-api.userlocal.jp
2017-02-27 09:42:12,849 - INFO - Thread-324 - Download: https://secure-api.userlocal.jp
2017-02-27 09:42:12,833 - INFO - MainThread - Sta Time: 2017-02-27 09:41:43.895126
2017-02-27 09:42:12,833 - INFO - MainThread - End Time: 2017-02-27 09:42:12.833492
2017-02-27 09:42:12,833 - INFO - MainThread - Run Time: 0:00:28.938366