logWrite replaced with logging module

This commit is contained in:
2023-06-23 11:25:27 +02:00
parent 23467a88ef
commit 4b43e76822
5 changed files with 50 additions and 27 deletions

View File

@@ -1,3 +1,4 @@
import logging
from datetime import datetime, timedelta
from uuid import uuid1
@@ -21,7 +22,9 @@ from modules.security import (
get_user,
verify_password,
)
from modules.utils import configGet, logWrite
from modules.utils import configGet
logger = logging.getLogger(__name__)
async def send_confirmation(user: str, email: str):
@@ -41,9 +44,11 @@ async def send_confirmation(user: str, email: str):
col_emails.insert_one(
{"user": user, "email": email, "used": False, "code": confirmation_code}
)
logWrite(f"Sent confirmation email to '{email}' with code {confirmation_code}")
logger.info(
"Sent confirmation email to '%s' with code %s", email, confirmation_code
)
except Exception as exp:
logWrite(f"Could not send confirmation email to '{email}' due to: {exp}")
logger.error("Could not send confirmation email to '%s' due to: %s", email, exp)
@app.get("/users/me/", response_model=User)