updated pages
This commit is contained in:
@@ -4,6 +4,14 @@ Server log model for audit trail
|
||||
|
||||
from app.extensions import db
|
||||
import datetime
|
||||
import pytz
|
||||
|
||||
# Get local timezone
|
||||
LOCAL_TZ = pytz.timezone('Europe/Bucharest') # Adjust this to your local timezone
|
||||
|
||||
def get_local_time():
|
||||
"""Get current local time"""
|
||||
return datetime.datetime.now(LOCAL_TZ).replace(tzinfo=None)
|
||||
|
||||
class ServerLog(db.Model):
|
||||
"""Server log model for tracking system actions"""
|
||||
@@ -13,7 +21,7 @@ class ServerLog(db.Model):
|
||||
user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=True)
|
||||
ip_address = db.Column(db.String(45), nullable=True) # Support IPv6
|
||||
user_agent = db.Column(db.Text, nullable=True)
|
||||
timestamp = db.Column(db.DateTime, default=datetime.datetime.utcnow, index=True)
|
||||
timestamp = db.Column(db.DateTime, default=get_local_time, index=True)
|
||||
level = db.Column(db.String(20), default='INFO') # INFO, WARNING, ERROR, DEBUG
|
||||
|
||||
# Relationships
|
||||
|
||||
Reference in New Issue
Block a user