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
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",
"succeeded" if success else "failed",
self.url,
response.status_code,
response.text
response.status_code
)
if not success:
@@ -83,13 +82,6 @@ class FiretextClient(SmsClient):
self.current_app.logger.info(log_message)
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):
data = {

View File

@@ -68,12 +68,11 @@ class MMGClient(SmsClient):
self.mmg_url = current_app.config.get('MMG_URL')
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",
"succeeded" if success else "failed",
self.mmg_url,
response.status_code,
response.text
response.status_code
)
if not success: