added font logging to news manager

This commit is contained in:
Chuck
2025-07-27 10:20:23 -05:00
parent 9b6231915a
commit 46ba9b4c4a

View File

@@ -227,7 +227,9 @@ class NewsManager:
# Load font # Load font
try: try:
font = ImageFont.truetype(self.font_path, self.font_size) font = ImageFont.truetype(self.font_path, self.font_size)
except: logger.debug(f"Successfully loaded custom font: {self.font_path}")
except Exception as e:
logger.warning(f"Failed to load custom font '{self.font_path}': {e}. Using default font.")
font = ImageFont.load_default() font = ImageFont.load_default()
# Calculate text width # Calculate text width
@@ -323,7 +325,9 @@ class NewsManager:
# Load font # Load font
try: try:
font = ImageFont.truetype(self.font_path, self.font_size) font = ImageFont.truetype(self.font_path, self.font_size)
except: logger.debug(f"Successfully loaded custom font: {self.font_path}")
except Exception as e:
logger.warning(f"Failed to load custom font '{self.font_path}': {e}. Using default font.")
font = ImageFont.load_default() font = ImageFont.load_default()
# Calculate vertical position (center the text) # Calculate vertical position (center the text)
@@ -373,7 +377,9 @@ class NewsManager:
try: try:
font = ImageFont.truetype(self.font_path, self.font_size) font = ImageFont.truetype(self.font_path, self.font_size)
except: logger.debug(f"Successfully loaded custom font: {self.font_path}")
except Exception as e:
logger.warning(f"Failed to load custom font '{self.font_path}': {e}. Using default font.")
font = ImageFont.load_default() font = ImageFont.load_default()
text = "Loading news..." text = "Loading news..."
@@ -397,7 +403,9 @@ class NewsManager:
try: try:
font = ImageFont.truetype(self.font_path, max(8, self.font_size - 2)) font = ImageFont.truetype(self.font_path, max(8, self.font_size - 2))
except: logger.debug(f"Successfully loaded custom font: {self.font_path}")
except Exception as e:
logger.warning(f"Failed to load custom font '{self.font_path}': {e}. Using default font.")
font = ImageFont.load_default() font = ImageFont.load_default()
text = f"News Error: {error_msg[:50]}..." text = f"News Error: {error_msg[:50]}..."