From b224346a972d841c1110613f9faf9a460be989ed Mon Sep 17 00:00:00 2001 From: Andy Doan Date: Fri, 8 Aug 2014 10:17:13 -0500 Subject: upload stats: provide more details about errors We weren't logging the API key or error reasons. This is a cheap hack to do it. It gives the error message in HTML, but it should be easy enough to grep in logs and keeps code simple. The resulting change produces output like: 1407510957.21: 192.168.0.101: INVALID_API_FORM: ca975604b5c779220bae8152fc7874, Change-Id: Ic50dcdaf1e89b08781cce5d0bdca493b86d26a08 --- license_protected_downloads/uploads.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/license_protected_downloads/uploads.py b/license_protected_downloads/uploads.py index 3bf6f67..a172f66 100644 --- a/license_protected_downloads/uploads.py +++ b/license_protected_downloads/uploads.py @@ -78,7 +78,8 @@ def file_server_post(request, path): form = UploadFileForm(request.POST, request.FILES) if not form.is_valid() or not path: - _log_metric(request, 'INVALID_API_FORM') + _log_metric(request, 'INVALID_API_FORM', + [request.POST['key'], str(form.errors)]) return HttpResponseServerError("Invalid call") _log_metric(request, 'FILE_UPLOAD', -- cgit v1.2.3