From ce85d0061923d93ac751ad57a4fa06a7c7da3b47 Mon Sep 17 00:00:00 2001 From: Ada Werefox Date: Sat, 9 Mar 2024 17:17:02 -0600 Subject: [PATCH] Added some initial logging for future potential debugging purposes. --- tunictracker/tracker/views.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tunictracker/tracker/views.py b/tunictracker/tracker/views.py index 0a02988..c26e87c 100644 --- a/tunictracker/tracker/views.py +++ b/tunictracker/tracker/views.py @@ -5,10 +5,13 @@ from json import loads, dumps from math import floor import requests from .forms import ServerAddressForm +import logging # Create your views here. default_address = 'http://localhost:8000/spoiler' +# logging.basicConfig(encoding='utf-8', level=logging.DEBUG) + def index(request): request_data = None @@ -21,11 +24,15 @@ def index(request): # server_address = read_address['address']['default'] if 'listen_address' in request.session.keys(): server_address = request.session['listen_address'] - print(request.session['listen_address']) + + # TODO: consider serializing user sessions for debugging in the future. + logging.info( + f'Session listen address changed to: {server_address}') else: request.session['listen_address'] = default_address - print(request.session['listen_address']) server_address = default_address + logging.info( + f'Session listen address for {request.session} set to: {server_address}') is_hidden = True try: request_data = requests.get( @@ -107,7 +114,6 @@ def set_address(request): # la.write(dumps(listen_address)) server_address = form.cleaned_data['server_address_form'] request.session['listen_address'] = form.cleaned_data['server_address_form'] - print(request.session['listen_address']) return HttpResponseRedirect('/') else: form = ServerAddressForm()