Skip to content

Commit 43f0480

Browse files
committed
add logging to view for debugging in cloud
1 parent 07db9d6 commit 43f0480

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

kolibri/plugins/facility/views.py

+7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import logging
23
from datetime import datetime as dt
34

45
from django.core.exceptions import PermissionDenied
@@ -33,6 +34,8 @@
3334

3435
content_kinds.QUIZ = "quiz"
3536

37+
logger = logging.getLogger(__name__)
38+
3639

3740
@method_decorator(cache_no_user_data, name="dispatch")
3841
class FacilityManagementView(TemplateView):
@@ -127,6 +130,7 @@ def exported_csv_info(request, facility_id):
127130

128131

129132
def download_csv_file(request, csv_type, facility_id):
133+
logger.info("Downloading CSV file for facility {}".format(facility_id))
130134

131135
facility = _get_facility_check_permissions(request, facility_id)
132136

@@ -201,6 +205,8 @@ def download_csv_file(request, csv_type, facility_id):
201205
else:
202206
filename = None
203207

208+
logger.info("Downloading CSV file: {}".format(filename))
209+
logger.info("{} exists: {}".format(filename, default_storage.exists(filename)))
204210
# if the file does not exist on disk, return a 404
205211
if filename is None or not default_storage.exists(filename):
206212
raise Http404("There is no csv export file for {} available".format(csv_type))
@@ -228,4 +234,5 @@ def download_csv_file(request, csv_type, facility_id):
228234
# set the content-length to the file size
229235
response.headers["Content-Length"] = default_storage.size(filename)
230236

237+
logger.info("Downloaded CSV file and responding")
231238
return response

0 commit comments

Comments
 (0)