Merge pull request #1806 from alphagov/update-logging

Update logging for provider tasks.
This commit is contained in:
Rebecca Law
2018-03-27 14:04:12 +01:00
committed by GitHub
2 changed files with 22 additions and 2 deletions

View File

@@ -22,10 +22,10 @@ def worker_process_shutdown(sender, signal, pid, exitcode):
@statsd(namespace="tasks")
def deliver_sms(self, notification_id):
try:
current_app.logger.info("Start sending SMS for notification id: {}".format(notification_id))
notification = notifications_dao.get_notification_by_id(notification_id)
if not notification:
raise NoResultFound()
current_app.logger.info("Start sending SMS for notification id: {}".format(notification_id))
send_to_providers.send_sms_to_provider(notification)
except Exception as e:
try:
@@ -44,10 +44,10 @@ def deliver_sms(self, notification_id):
@statsd(namespace="tasks")
def deliver_email(self, notification_id):
try:
current_app.logger.info("Start sending email for notification id: {}".format(notification_id))
notification = notifications_dao.get_notification_by_id(notification_id)
if not notification:
raise NoResultFound()
current_app.logger.info("Start sending email for notification id: {}".format(notification_id))
send_to_providers.send_email_to_provider(notification)
except InvalidEmailError as e:
current_app.logger.exception(e)