From cbd878481e9ece86723a1e7c8e46af68f8529319 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Fri, 30 Oct 2026 21:39:14 -0500 Subject: [PATCH] change log levels --- frigate/analytics/report.py | 2 +- frigate/analytics/state.py | 4 ++-- frigate/analytics/transport.py | 6 +++--- frigate/test/test_analytics_transport.py | 8 ++++++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/frigate/analytics/report.py b/frigate/analytics/report.py index b1c89f2281..e65c66ce44 100644 --- a/frigate/analytics/report.py +++ b/frigate/analytics/report.py @@ -51,7 +51,7 @@ def build_report( sections[name] = collect(ctx) except Exception: # a collector bug must cost one section, never the whole report - logger.warning("Analytics %s section failed", name, exc_info=True) + logger.debug("Analytics %s section failed", name, exc_info=True) sections[name] = None return AnalyticsReport.model_validate( diff --git a/frigate/analytics/state.py b/frigate/analytics/state.py index a321285ed5..ca2033d3f6 100644 --- a/frigate/analytics/state.py +++ b/frigate/analytics/state.py @@ -33,7 +33,7 @@ def load_state(path: str = STATE_PATH) -> AnalyticsState | None: except FileNotFoundError: return None except (OSError, ValueError): - logger.warning("Ignoring unreadable analytics state at %s", path) + logger.debug("Ignoring unreadable analytics state at %s", path) return None if not isinstance(data, dict): @@ -48,7 +48,7 @@ def load_state(path: str = STATE_PATH) -> AnalyticsState | None: or isinstance(last_attempt_at, bool) or not isinstance(last_attempt_at, int | float) ): - logger.warning("Ignoring invalid analytics state at %s", path) + logger.debug("Ignoring invalid analytics state at %s", path) return None return AnalyticsState(install_id=install_id, last_attempt_at=float(last_attempt_at)) diff --git a/frigate/analytics/transport.py b/frigate/analytics/transport.py index d26770f434..f672940857 100644 --- a/frigate/analytics/transport.py +++ b/frigate/analytics/transport.py @@ -34,7 +34,7 @@ def send_report(url: str, body: str) -> SendOutcome: allow_redirects=False, ) except requests.RequestException as err: - logger.warning("Unable to send the analytics report: %s", err) + logger.debug("Unable to send the analytics report: %s", err) return SendOutcome.failed status = response.status_code @@ -43,12 +43,12 @@ def send_report(url: str, body: str) -> SendOutcome: return SendOutcome.accepted if status == 400: - logger.warning("The analytics report was rejected: %s", response.text[:200]) + logger.debug("The analytics report was rejected: %s", response.text[:200]) return SendOutcome.rejected if status == 429: logger.debug("The analytics endpoint is rate limiting this install") return SendOutcome.rate_limited - logger.warning("The analytics endpoint returned %s", status) + logger.debug("The analytics endpoint returned %s", status) return SendOutcome.failed diff --git a/frigate/test/test_analytics_transport.py b/frigate/test/test_analytics_transport.py index 35e0edc166..ba75cdb706 100644 --- a/frigate/test/test_analytics_transport.py +++ b/frigate/test/test_analytics_transport.py @@ -49,12 +49,16 @@ class TestSendReport(unittest.TestCase): def test_logs_the_rejection_reason(self): with ( post(400, "install_id: bad"), - self.assertLogs("frigate.analytics.transport", "WARNING") as logs, + self.assertLogs("frigate.analytics.transport", "DEBUG") as logs, ): send_report(URL, "{}") self.assertIn("install_id: bad", logs.output[0]) def test_a_network_error_fails_without_raising(self): - with post(side_effect=requests.ConnectionError("down")): + # the user can't act on a failed send, so it stays out of warnings + with ( + post(side_effect=requests.ConnectionError("down")), + self.assertNoLogs("frigate.analytics.transport", "WARNING"), + ): self.assertIs(send_report(URL, "{}"), SendOutcome.failed)