🔊 Enable logging for email utils by default (#1374)

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
Hmily
2024-09-28 00:39:40 +08:00
committed by GitHub
parent 2939b7723b
commit ddb4235bfe

View File

@@ -11,6 +11,9 @@ from jwt.exceptions import InvalidTokenError
from app.core.config import settings from app.core.config import settings
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
@dataclass @dataclass
class EmailData: class EmailData:
@@ -48,7 +51,7 @@ def send_email(
if settings.SMTP_PASSWORD: if settings.SMTP_PASSWORD:
smtp_options["password"] = settings.SMTP_PASSWORD smtp_options["password"] = settings.SMTP_PASSWORD
response = message.send(to=email_to, smtp=smtp_options) response = message.send(to=email_to, smtp=smtp_options)
logging.info(f"send email result: {response}") logger.info(f"send email result: {response}")
def generate_test_email(email_to: str) -> EmailData: def generate_test_email(email_to: str) -> EmailData: