Convert into MVC and optimize the code

This commit is contained in:
Pooja Fulari
2026-04-15 12:05:28 +05:30
parent 92670665c3
commit c6f543c63f
538 changed files with 923 additions and 881 deletions

17
app/service/logger.py Normal file
View File

@@ -0,0 +1,17 @@
import os
from flask import current_app
from datetime import datetime
def log_activity(user, action, details=""):
try:
log_file = os.path.join(current_app.root_path, "activity.log")
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
with open(log_file, "a") as f:
f.write(
f"Timestamp: {timestamp} | User: {user} | "
f"Action: {action} | Details: {details}\n"
)
except Exception as e:
print(f"Logging failed: {e}")