Skip to content

Commit

Permalink
Detailed request/response logging for troubleshooting.
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-ide committed Dec 12, 2023
1 parent f4814cb commit 8f13acd
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions webapp/home/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import webapp.mimemail as mimemail

from webapp.config import Config
from webapp.home.home_utils import log_error, log_info
from webapp.home.home_utils import log_error, log_info, log_available_memory

import csv

Expand Down Expand Up @@ -145,7 +145,8 @@ def log_request():
return

referrer = request.referrer
# log_info(f'**** INCOMING REQUEST: {url} [{request.method}] REFERRER: {referrer}')
log_info(f'**** INCOMING REQUEST: {url} [{request.method}] REFERRER: {referrer}')
log_available_memory()


@home_bp.after_app_request
Expand All @@ -157,10 +158,11 @@ def log_response(response):
if '/static/' in url or 'youtube.png' in url or 'favicon.ico' in url or 'logo.png' in url:
return response

# if response:
# log_info(f'**** OUTGOING RESPONSE: {request.remote_addr} [{request.method}] {request.full_path} {response.status}')
# else:
# log_info('**** OUTGOING RESPONSE: None')
if response:
log_info(f'**** OUTGOING RESPONSE: {request.remote_addr} [{request.method}] {request.full_path} {response.status}')
else:
log_info('**** OUTGOING RESPONSE: None')
log_available_memory()
return response


Expand Down

0 comments on commit 8f13acd

Please sign in to comment.