Skip to content

Commit 44f8ded

Browse files
committed
log request before and after processing
1 parent 1f3b3ac commit 44f8ded

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

backend/restapi_server.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ def main():
7171
app.register_blueprint(attrs_api)
7272
app.register_blueprint(project_api)
7373

74+
# hook up request signal to log request by UI
75+
@app.before_request
76+
def before_request():
77+
log(f"{request.method} {request.url}")
78+
79+
@app.after_request
80+
def after_request(response):
81+
log(f"{request.method} {request.url} {response.status_code} - DONE")
82+
return response
83+
7484
# log app server started
7585
log("App server is running...")
7686

0 commit comments

Comments
 (0)