From 6fb4e1606773b4430a9474af5742dc6afed3850b Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Wed, 12 Jul 2017 14:19:39 +0100 Subject: [PATCH] Added logging to show the entire form posted to us by the SMS client providers. This can be useful information when debugging what happened to a notificaiton. Recently there was a discrepancy between the failure type used by each provider for a particular number, this logging would have helped. --- app/notifications/notifications_sms_callback.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/notifications/notifications_sms_callback.py b/app/notifications/notifications_sms_callback.py index 3c569e158..430e1c149 100644 --- a/app/notifications/notifications_sms_callback.py +++ b/app/notifications/notifications_sms_callback.py @@ -1,4 +1,5 @@ from flask import Blueprint +from flask import current_app from flask import json from flask import request, jsonify @@ -22,6 +23,10 @@ def process_mmg_response(): success, errors = process_sms_client_response(status=str(data.get('status')), reference=data.get('CID'), client_name=client_name) + + current_app.logger.info( + "Full delivery response from {} for notification: {}\n{}".format(client_name, request.form.get('reference'), + request.form)) if errors: raise InvalidRequest(errors, status_code=400) else: @@ -38,6 +43,9 @@ def process_firetext_response(): raise InvalidRequest(errors, status_code=400) status = request.form.get('status') + current_app.logger.info( + "Full delivery response from {} for notification: {}\n{}".format(client_name, request.form.get('reference'), + request.form)) success, errors = process_sms_client_response(status=status, reference=request.form.get('reference'), client_name=client_name)