From 3eb8cf0fb7276cdb8ce61929964341df579800d5 Mon Sep 17 00:00:00 2001 From: sebthom Date: Sat, 12 Mar 2022 14:29:16 +0100 Subject: [PATCH] suppress irrelevant WDM/browser log output by default --- kleinanzeigen_bot/selenium_mixin.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kleinanzeigen_bot/selenium_mixin.py b/kleinanzeigen_bot/selenium_mixin.py index 81ad5c5..13886a0 100644 --- a/kleinanzeigen_bot/selenium_mixin.py +++ b/kleinanzeigen_bot/selenium_mixin.py @@ -86,6 +86,10 @@ class SeleniumMixin: "profile.default_content_setting_values.notifications": 2, # 1 = allow, 2 = block browser notifications "devtools.preferences.currentDockState": "\"bottom\"" }) + + if not LOG.isEnabledFor(logging.DEBUG): + browser_options.add_argument("--log-level=3") # INFO: 0, WARNING: 1, ERROR: 2, FATAL: 3 + LOG.debug("Effective experimental options: %s", browser_options.experimental_options) if self.browser_config.binary_location: @@ -93,6 +97,9 @@ class SeleniumMixin: LOG.info(" -> Chrome binary location: %s", self.browser_config.binary_location) return browser_options + if not LOG.isEnabledFor(logging.DEBUG): + os.environ['WDM_LOG_LEVEL'] = '0' # silence the web driver manager + # check if a chrome driver is present already if shutil.which(DEFAULT_CHROMEDRIVER_PATH): self.webdriver = webdriver.Chrome(options = init_browser_options(webdriver.ChromeOptions()))