adds logging to all gui requests
This commit is contained in:
parent
5a30b1a784
commit
f5b3716810
@ -1,11 +1,11 @@
|
||||
from flask import Flask
|
||||
from flask import Flask, request
|
||||
|
||||
from .config import Config
|
||||
from .db import db
|
||||
from .models import init_schedule_config
|
||||
from .models import ActivityLog, ActivityCategory
|
||||
from .blueprints import register_blueprints
|
||||
|
||||
|
||||
def create_app(test_config=None):
|
||||
app = Flask(__name__)
|
||||
app.config.from_object(Config)
|
||||
@ -25,4 +25,12 @@ def create_app(test_config=None):
|
||||
|
||||
register_blueprints(app)
|
||||
|
||||
@app.before_request
|
||||
def before_request():
|
||||
ActivityLog.log_gui_interaction(
|
||||
action=request.endpoint,
|
||||
description=f"Request to {request.endpoint}",
|
||||
extra={"method": request.method, "url": request.url}
|
||||
)
|
||||
|
||||
return app
|
||||
|
Loading…
x
Reference in New Issue
Block a user