2026-01-24 02:11:19 +05:30
|
|
|
import os
|
2025-11-30 16:24:49 +05:30
|
|
|
from flask import Flask, render_template, request, redirect, url_for, send_from_directory, flash, jsonify, json
|
|
|
|
|
from flask import current_app
|
|
|
|
|
from datetime import datetime
|
|
|
|
|
from flask_login import LoginManager, UserMixin, login_user, logout_user, login_required, current_user
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LogHelper:
|
|
|
|
|
@staticmethod
|
|
|
|
|
def log_action(action, details=""):
|
|
|
|
|
"""Log user actions with timestamp, user, action, and details."""
|
|
|
|
|
logData = LogData()
|
|
|
|
|
logData.WriteLog(action, details="")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LogData:
|
|
|
|
|
filepath = ""
|
|
|
|
|
timestamp = None
|
|
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
|
self.filepath = os.path.join(current_app.root_path, 'activity.log')
|
|
|
|
|
self.timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|