From 48df81fa5744ed9d72c4a7d00d78b5be7217d41a Mon Sep 17 00:00:00 2001 From: Sam Yun Date: Fri, 22 Sep 2017 14:32:53 -0400 Subject: [PATCH] Print INFO level logging to console, print DEBUG level logging to file --- EMS Paperwork Tool/autofill_tool.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/EMS Paperwork Tool/autofill_tool.py b/EMS Paperwork Tool/autofill_tool.py index a369b45..9a8913b 100644 --- a/EMS Paperwork Tool/autofill_tool.py +++ b/EMS Paperwork Tool/autofill_tool.py @@ -877,6 +877,7 @@ def go_to_w2w_with_date(self): """ # navigate to W2W + self.logger.info("Navigating to WhenToWork") self.driver.get('https://whentowork.com/logins.htm') # if not logged in, log in. @@ -1028,13 +1029,17 @@ def setup(): logger.basicConfig(format='%(asctime)s %(levelname)s:%(message)s', filename='debug_log.log', - level=logger.INFO, + level=logger.DEBUG, datefmt='%m/%d/%Y %I:%M:%S %p') - logger.getLogger().addHandler(logger.StreamHandler()) selenium_logger = logger.getLogger('selenium.webdriver.remote.remote_connection') # Only display possible problems selenium_logger.setLevel(logger.WARNING) + # define a Handler which writes INFO messages or higher to the sys.stderr + console = logger.StreamHandler() + console.setLevel(logger.INFO) + logger.getLogger('').addHandler(console) + logger.info("******************* Running Autofill Tool *******************") # check platform, clear screen