reduce log spam

This commit is contained in:
Chuck
2025-08-11 15:45:19 -05:00
parent da17f214da
commit 865b30c631
2 changed files with 19 additions and 5 deletions

View File

@@ -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.")

View File

@@ -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