aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Doan <andy.doan@linaro.org>2014-08-08 10:17:13 -0500
committerAndy Doan <andy.doan@linaro.org>2014-08-08 10:17:13 -0500
commitb224346a972d841c1110613f9faf9a460be989ed (patch)
treecb9c25c7dedaf7f8a8f7d027766e3102cf07afd5
parent92e3a3cc1ac91708b109a79d32497c8381eac5da (diff)
upload stats: provide more details about errors2014.07.3
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,<ul class="errorlist"><li>file<ul class="errorlist"><li>This field is required.</li></ul></li></ul> Change-Id: Ic50dcdaf1e89b08781cce5d0bdca493b86d26a08
-rw-r--r--license_protected_downloads/uploads.py3
1 files changed, 2 insertions, 1 deletions
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',