From 865b30c631fe6c0225c21aa57555aa9146834d84 Mon Sep 17 00:00:00 2001 From: Chuck <33324927+ChuckBuilds@users.noreply.github.com> Date: Mon, 11 Aug 2025 15:45:19 -0500 Subject: [PATCH] reduce log spam --- src/display_controller.py | 12 ++++++++++-- src/milb_manager.py | 12 +++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/display_controller.py b/src/display_controller.py index fe1f55e2..54e8cdb5 100644 --- a/src/display_controller.py +++ b/src/display_controller.py @@ -1172,7 +1172,11 @@ class DisplayController: logger.info(f"Showing {self.current_display_mode}") self._last_logged_mode = self.current_display_mode - logger.info(f"manager_to_display is {type(manager_to_display).__name__ if manager_to_display else 'None'}") + # Only log manager type when it changes to reduce spam + current_manager_type = type(manager_to_display).__name__ if manager_to_display else 'None' + if current_manager_type != getattr(self, '_last_logged_manager_type', None): + logger.info(f"manager_to_display is {current_manager_type}") + self._last_logged_manager_type = current_manager_type if self.current_display_mode == 'music' and self.music_manager: # Call MusicManager's display method @@ -1235,7 +1239,11 @@ class DisplayController: # Special handling for live managers that need update before display if self.current_display_mode.endswith('_live') and hasattr(manager_to_display, 'update'): manager_to_display.update() - logger.info(f"Calling display method for {self.current_display_mode}") + # Only log display method calls occasionally to reduce spam + current_time = time.time() + if not hasattr(self, '_last_display_method_log_time') or current_time - getattr(self, '_last_display_method_log_time', 0) >= 30: + logger.info(f"Calling display method for {self.current_display_mode}") + self._last_display_method_log_time = current_time manager_to_display.display(force_clear=self.force_clear) else: logger.warning(f"Manager {type(manager_to_display).__name__} for mode {self.current_display_mode} does not have a standard 'display' method.") diff --git a/src/milb_manager.py b/src/milb_manager.py index 8d2fc2df..1668ee3f 100644 --- a/src/milb_manager.py +++ b/src/milb_manager.py @@ -1549,7 +1549,6 @@ class MiLBUpcomingManager(BaseMiLBManager): def update(self): """Update upcoming games data.""" - self.logger.info("[MiLB] Update method called") current_time = time.time() # Add a check to see if the manager is enabled @@ -1567,6 +1566,9 @@ class MiLBUpcomingManager(BaseMiLBManager): if self.last_update != 0 and (current_time - self.last_update < self.update_interval): return + # Only log when we're actually performing an update + self.logger.info("[MiLB] Update method called - performing update") + try: # Fetch data from MiLB API games = self._fetch_milb_api_data(use_cache=True) @@ -1694,9 +1696,13 @@ class MiLBUpcomingManager(BaseMiLBManager): def display(self, force_clear: bool = False): """Display upcoming games.""" - self.logger.info(f"[MiLB] Display called with {len(self.upcoming_games)} upcoming games") + # Only log display calls occasionally to reduce spam + current_time = time.time() + if not hasattr(self, '_last_display_log_time') or current_time - getattr(self, '_last_display_log_time', 0) >= 30: + self.logger.info(f"[MiLB] Display called with {len(self.upcoming_games)} upcoming games") + self._last_display_log_time = current_time + if not self.upcoming_games: - current_time = time.time() if current_time - self.last_warning_time > self.warning_cooldown: self.logger.info("[MiLB] No upcoming games to display") self.last_warning_time = current_time