fix: use print instead of logger for dev mode email output

Logger.info wasn't visible in gunicorn container logs. Using print
with flush=True ensures magic link URLs are visible in container
logs for QA testing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-22 18:16:48 -07:00
parent 5a9f0d552a
commit 80f7926985
2 changed files with 30 additions and 31 deletions

View File

@@ -61,13 +61,13 @@ class EmailService:
Exception: If email sending fails
"""
if self.dev_mode:
# In dev mode, just log the email
logger.info("=" * 80)
logger.info("DEV MODE: Email not sent")
logger.info(f"To: {to}")
logger.info(f"Subject: {subject}")
logger.info(f"Body preview: {html_body[:200]}...")
logger.info("=" * 80)
# In dev mode, print email details to stdout for QA testing
print("=" * 80)
print("DEV MODE: Email not sent")
print(f"To: {to}")
print(f"Subject: {subject}")
print(f"Body preview: {html_body[:200]}...")
print("=" * 80, flush=True)
# Return a mock success response
return {"id": f"dev-mode-{os.urandom(8).hex()}"}
@@ -99,7 +99,7 @@ class EmailService:
Response from email service
"""
if self.dev_mode:
logger.info(f"DEV MODE: Magic link URL: {magic_link_url}")
print(f"DEV MODE: Magic link URL: {magic_link_url}", flush=True)
subject = f"Access your {exchange_name} Secret Santa"
html_body = f"""
@@ -143,7 +143,7 @@ class EmailService:
Response from email service
"""
if self.dev_mode:
logger.info(f"DEV MODE: Magic link URL: {magic_link_url}")
print(f"DEV MODE: Magic link URL: {magic_link_url}", flush=True)
subject = f"Welcome to {exchange_name}!"