Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔊 Enable logging for email utils by default #1374

Merged
merged 2 commits into from
Sep 27, 2024

Conversation

ihmily
Copy link
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
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
12 checks passed
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