Updated logging as logger was parsing some JSON and erroring.

- Don't write whole JSON response. Safer not to anyway. No need.
This commit is contained in:
Martyn Inglis
2016-09-23 10:24:12 +01:00
parent 137aa1e2d2
commit 54c28a4bea
2 changed files with 4 additions and 13 deletions

View File

@@ -68,12 +68,11 @@ class FiretextClient(SmsClient):
return self.name return self.name
def record_outcome(self, success, response): def record_outcome(self, success, response):
log_message = "API {} request {} on {} response status_code {} response text'{}'".format( log_message = "API {} request {} on {} response status_code {}".format(
"POST", "POST",
"succeeded" if success else "failed", "succeeded" if success else "failed",
self.url, self.url,
response.status_code, response.status_code
response.text
) )
if not success: if not success:
@@ -83,13 +82,6 @@ class FiretextClient(SmsClient):
self.current_app.logger.info(log_message) self.current_app.logger.info(log_message)
self.statsd_client.incr("clients.firetext.success") self.statsd_client.incr("clients.firetext.success")
@staticmethod
def check_response(response):
response.raise_for_status()
json.loads(response.text)
if response.json()['code'] != 0:
raise ValueError()
def send_sms(self, to, content, reference, sender=None): def send_sms(self, to, content, reference, sender=None):
data = { data = {

View File

@@ -68,12 +68,11 @@ class MMGClient(SmsClient):
self.mmg_url = current_app.config.get('MMG_URL') self.mmg_url = current_app.config.get('MMG_URL')
def record_outcome(self, success, response): def record_outcome(self, success, response):
log_message = "API {} request {} on {} response status_code {} response text'{}'".format( log_message = "API {} request {} on {} response status_code {}".format(
"POST", "POST",
"succeeded" if success else "failed", "succeeded" if success else "failed",
self.mmg_url, self.mmg_url,
response.status_code, response.status_code
response.text
) )
if not success: if not success: