Skip to content

🔊 Enable logging for email utils by default#1374

Merged
tiangolo merged 2 commits intofastapi:masterfrom
ihmily:fix-log-print
Sep 27, 2024
Merged

🔊 Enable logging for email utils by default#1374
tiangolo merged 2 commits intofastapi:masterfrom
ihmily:fix-log-print

Conversation

@ihmily
Copy link
Copy Markdown
Contributor

@ihmily ihmily commented Sep 26, 2024

In the code, there is only this line:

response = message.send(to=email_to, smtp=smtp_options)
logging.info(f"send email result: {response}")

Without any log configuration (such as setting the log level, format, and handler), in most cases, this log message will not be displayed on the console, nor will it be automatically recorded in a log file.
https://github.com/fastapi/full-stack-fastapi-template/blob/451c656fb052c9ff00e0da507a42d549c0f184cb/backend/app/utils.py#L50C1-L51C51

I can't see the log <emails.backend.SMTPResponse status_code=501 status_text=b'Mail from address must be same as authorization user.'>

@tiangolo tiangolo changed the title 🐛 Fix log print for utils 🐛 Fix log print for email utils Sep 27, 2024
@tiangolo tiangolo changed the title 🐛 Fix log print for email utils 🔊 Enable logging for email utils by default Sep 27, 2024
@tiangolo
Copy link
Copy Markdown
Member

Cool, thanks! ☕

@tiangolo tiangolo enabled auto-merge (squash) September 27, 2024 16:39
@tiangolo tiangolo merged commit ddb4235 into fastapi:master Sep 27, 2024
rajdavee pushed a commit to OrganyzAI/python-backend that referenced this pull request Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants