working now
This commit is contained in:
@@ -9,6 +9,9 @@ from fastapi import Request
|
||||
|
||||
from app.models.audit import AuditLog, LoginAttempt
|
||||
from app.models.user import User
|
||||
from app.core.logging import get_logger
|
||||
|
||||
logger = get_logger("audit")
|
||||
|
||||
|
||||
class AuditService:
|
||||
@@ -73,7 +76,7 @@ class AuditService:
|
||||
except Exception as e:
|
||||
db.rollback()
|
||||
# Log the error but don't fail the main operation
|
||||
print(f"Failed to log audit entry: {e}")
|
||||
logger.error("Failed to log audit entry", error=str(e), action=action, user_id=user_id)
|
||||
return audit_log
|
||||
|
||||
@staticmethod
|
||||
@@ -128,7 +131,7 @@ class AuditService:
|
||||
except Exception as e:
|
||||
db.rollback()
|
||||
# Log the error but don't fail the main operation
|
||||
print(f"Failed to log login attempt: {e}")
|
||||
logger.error("Failed to log login attempt", error=str(e), username=username, success=success)
|
||||
return login_attempt
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user