From fa2c4680cca0d1d6b46e6c1ed68ceea4d9b79afb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 14 Mar 2022 12:00:35 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=87=20Less=20scary=20log=20on=20invali?= =?UTF-8?q?d=20announcement=20cache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/plugins/announcements/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/octoprint/plugins/announcements/__init__.py b/src/octoprint/plugins/announcements/__init__.py index 149ee90b6..82ea66c2b 100644 --- a/src/octoprint/plugins/announcements/__init__.py +++ b/src/octoprint/plugins/announcements/__init__.py @@ -4,6 +4,7 @@ __copyright__ = "Copyright (C) 2016 The OctoPrint Project - Released under terms import calendar +import logging import os import re import threading @@ -436,9 +437,11 @@ class AnnouncementPlugin( self._logger.debug(f"Loaded channel {key} from cache at {channel_path}") return d except Exception: - self._logger.exception( - f"Could not read channel {key} from cache {channel_path}" - ) + if self._logger.isEnabledFor(logging.DEBUG): + self._logger.exception( + f"Could not read channel {key} from cache at {channel_path}" + ) + try: os.remove(channel_path) except OSError: