mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-21 16:01:15 -05:00
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:
@@ -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 = {
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user