From 5684c681216e14e26464b6e66bd3b8fdf66cf140 Mon Sep 17 00:00:00 2001 From: teknium1 Date: Sat, 7 Mar 2026 21:24:47 -0800 Subject: [PATCH] Add logger.info/error for image extraction and delivery debugging --- gateway/platforms/base.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gateway/platforms/base.py b/gateway/platforms/base.py index c06bb6f9..d787cc93 100644 --- a/gateway/platforms/base.py +++ b/gateway/platforms/base.py @@ -701,6 +701,8 @@ class BasePlatformAdapter(ABC): # Extract image URLs and send them as native platform attachments images, text_content = self.extract_images(response) + if images: + logger.info("[%s] extract_images found %d image(s) in response (%d chars)", self.name, len(images), len(response)) # Send the text portion first (if any remains after extractions) if text_content: @@ -727,10 +729,13 @@ class BasePlatformAdapter(ABC): human_delay = self._get_human_delay() # Send extracted images as native attachments + if images: + logger.info("[%s] Extracted %d image(s) to send as attachments", self.name, len(images)) for image_url, alt_text in images: if human_delay > 0: await asyncio.sleep(human_delay) try: + logger.info("[%s] Sending image: %s (alt=%s)", self.name, image_url[:80], alt_text[:30] if alt_text else "") # Route animated GIFs through send_animation for proper playback if self._is_animation_url(image_url): img_result = await self.send_animation( @@ -745,9 +750,9 @@ class BasePlatformAdapter(ABC): caption=alt_text if alt_text else None, ) if not img_result.success: - print(f"[{self.name}] Failed to send image: {img_result.error}") + logger.error("[%s] Failed to send image: %s", self.name, img_result.error) except Exception as img_err: - print(f"[{self.name}] Error sending image: {img_err}") + logger.error("[%s] Error sending image: %s", self.name, img_err, exc_info=True) # Send extracted media files — route by file type _AUDIO_EXTS = {'.ogg', '.opus', '.mp3', '.wav', '.m4a'}