Skip to content

Commit

Permalink
Test logging options
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeweerd committed Nov 4, 2023
1 parent ef12fdf commit 7fe68e9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions apps/meters_to_ha/meters_to_ha.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,8 @@ def init_chromium(self):
else:
options = webdriver.ChromeOptions()

log_level = self.get_log_level()

# Set Chrome options
if (
sys.platform != "win32"
Expand Down Expand Up @@ -673,7 +675,7 @@ def init_chromium(self):
options.add_argument("--disable-extensions")
options.add_argument("--disable-popup-blocking")
options.add_argument("--disable-background-timer-throttling")
options.add_argument("--disable-backgrounding-occluded-wndows")
options.add_argument("--disable-backgrounding-occluded-windows")
options.add_argument("--disable-translate")
options.add_argument("--disable-notifications")
options.add_argument("--disable-infobars")
Expand All @@ -690,6 +692,15 @@ def init_chromium(self):
if sys.platform != "win32":
self.mylog("Start virtual display (Chromium).", end="")

if log_level < logging.INFO:
options.add_argument("--log-level=1")
options.add_argument("--enable-logging")
options.add_argument("--v=1")
if log_level < logging.WARNING:
options.add_argument("--enable-logging")
options.add_argument("--log-level=0")
options.add_argument("--v=0")

if self._debug:
if sys.platform != "win32":
self.__display = Display(visible=1, size=(1280, 1024))
Expand Down Expand Up @@ -727,7 +738,6 @@ def init_chromium(self):
self.configuration[PARAM_LOGS_FOLDER],
"chromedriver.log",
)
log_level = self.get_log_level()
chromium_service_args = (
["--verbose"] if log_level < logging.INFO else None
)
Expand Down

0 comments on commit 7fe68e9

Please sign in to comment.