mirror of
https://github.com/User0332/rewards-farmer.git
synced 2026-09-16 01:31:36 +00:00
quieten routine tab logging and harden the failure summary
Follow-ups from running the conversion against a live account. Tab open/close bookkeeping moves from info to debug. It was 19 of the 33 records in a full run, so the six task outcomes that are the point of the summary were outnumbered three to one by tab handles and query strings. The "could not close" case stays at warning, a tab that will not close is a real problem rather than bookkeeping. The [FAIL] summary moves into log_utils.exception_summary, which takes the first line, drops the "(Session info: ...)" fragment and caps the result. A selenium exception embeds the whole msedgedriver stacktrace in str(), and the cap means a pathological message cannot push a screenful of text into one record. The cut marker is ASCII because this can land on a Windows console whose encoding cannot represent an ellipsis. The suppressed-library list was checked rather than guessed: with the root logger wide open, a real browser session plus one ollama call produced records from httpx, httpcore, urllib3 and selenium only, and nothing else. That set is already pinned. Worth noting selenium alone emits 45 records for a single page load, so without the pinning the debug mode this PR recommends for bug reports would be unusable.
This commit is contained in:
+7
-3
@@ -33,7 +33,7 @@ document.dispatchEvent(new Event('visibilitychange'));
|
||||
self.driver.switch_to.window(handle)
|
||||
|
||||
if self.driver.current_url in GHOST_TAB_URLS:
|
||||
logger.info("Found ghost tab with handle %s and URL %s.", handle, self.driver.current_url)
|
||||
logger.debug("Found ghost tab with handle %s and URL %s.", handle, self.driver.current_url)
|
||||
continue
|
||||
|
||||
self.ensure_focus()
|
||||
@@ -50,14 +50,18 @@ document.dispatchEvent(new Event('visibilitychange'));
|
||||
self.driver.switch_to.window(handle)
|
||||
|
||||
if self.driver.current_url in GHOST_TAB_URLS:
|
||||
logger.info("Found ghost tab with handle %s and URL %s, not closing.", handle, self.driver.current_url)
|
||||
logger.debug("Found ghost tab with handle %s and URL %s, not closing.", handle, self.driver.current_url)
|
||||
continue
|
||||
|
||||
tab_url = self.driver.current_url
|
||||
|
||||
try:
|
||||
self.driver.close()
|
||||
logger.info("Closed tab with handle %s and URL %s.", handle, tab_url)
|
||||
# Routine bookkeeping, one line per tab. At info it drowned
|
||||
# the task summary: 19 of the 33 records in a full run were
|
||||
# these. The warning below stays at warning, a tab that will
|
||||
# not close is a real problem.
|
||||
logger.debug("Closed tab with handle %s and URL %s.", handle, tab_url)
|
||||
|
||||
except WebDriverException:
|
||||
logger.warning("Could not close tab with handle %s and URL %s.", handle, tab_url)
|
||||
|
||||
Reference in New Issue
Block a user