From 8155c91d90ea5727ec75dd19781f3b9d2b022407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Senart?= Date: Thu, 15 Apr 2021 19:42:55 +0200 Subject: [PATCH] Remove useless warning log messages (log message level has been decreased to debug). --- CHANGELOG.md | 5 +++++ pygazpar/webdriverwrapper.py | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c5a6e6..27d4305 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.25] - 2021-04-15 +### Fixed +- Remove useless warning log messages (log message level has been decreased to debug). + ## [0.1.24] - 2021-04-14 ### Added - README.md amendment (thanks to pbranly). @@ -95,6 +99,7 @@ It occurs with the page containing 'Jour' button which is very long to load (I i ### Removed - Remove Client.data property to get the updated data. Replaced with Client.__data private property. +[0.1.25]: https://github.com/ssenart/PyGazpar/compare/0.1.24...0.1.25 [0.1.24]: https://github.com/ssenart/PyGazpar/compare/0.1.23...0.1.24 [0.1.23]: https://github.com/ssenart/PyGazpar/compare/0.1.22...0.1.23 [0.1.22]: https://github.com/ssenart/PyGazpar/compare/0.1.21...0.1.22 diff --git a/pygazpar/webdriverwrapper.py b/pygazpar/webdriverwrapper.py index 24a7489..f69cb73 100644 --- a/pygazpar/webdriverwrapper.py +++ b/pygazpar/webdriverwrapper.py @@ -87,9 +87,12 @@ def find_element_by_id(self, id: str, description: str, screenshotOnNotFound: bo WebDriverWrapper.logger.debug(f"find_element_by_id('{id}'): {description} -> Ok") return res except Exception: - WebDriverWrapper.logger.warning(f"find_element_by_id('{id}'): {description} -> Not found", exc_info=False) + message = f"find_element_by_id('{id}'): {description} -> Not found" if screenshotOnNotFound: + WebDriverWrapper.logger.warning(message, exc_info=True) self.__driver.save_screenshot(f"{self.__tmp_directory}/error_screenshot.png") + else: + WebDriverWrapper.logger.debug(message, exc_info=False) raise # ------------------------------------------------------ @@ -102,9 +105,12 @@ def find_element_by_xpath(self, xpath: str, description: str, screenshotOnNotFou WebDriverWrapper.logger.debug(f"find_element_by_xpath('{xpath}'): {description} -> Ok") return res except Exception: - WebDriverWrapper.logger.warning(f"find_element_by_xpath('{xpath}'): {description} -> Not found", exc_info=False) + message = f"find_element_by_xpath('{xpath}'): {description} -> Not found" if screenshotOnNotFound: + WebDriverWrapper.logger.warning(message, exc_info=True) self.__driver.save_screenshot(f"{self.__tmp_directory}/error_screenshot.png") + else: + WebDriverWrapper.logger.debug(message, exc_info=False) raise # ------------------------------------------------------