06/05 Optimize app: logs will be saved to db

This commit is contained in:
2026-06-05 12:48:55 -04:00
parent 8f8b0348c6
commit f8114e7997
8 changed files with 355 additions and 94 deletions
+15
View File
@@ -0,0 +1,15 @@
from app.extensions import db
from datetime import datetime
class AppLog(db.Model):
__tablename__ = 'app_logs'
id = db.Column(db.Integer, primary_key=True)
timestamp = db.Column(db.DateTime, default=datetime.utcnow, index=True)
level = db.Column(db.String(16), nullable=False, index=True)
module = db.Column(db.String(128))
message = db.Column(db.Text)
def __repr__(self):
return f'<AppLog {self.level} {self.timestamp}>'