diff --git a/gracedb/alert.py b/gracedb/alert.py index a6ec2d79decc29289f7eb88858116c1047601891..522228733ed44183275fb541bde3d7950268bb76 100644 --- a/gracedb/alert.py +++ b/gracedb/alert.py @@ -10,6 +10,7 @@ from permission_utils import is_external import json import logging +log = logging.getLogger(__name__) from django_twilio.client import twilio_client @@ -28,7 +29,6 @@ if settings.USE_LVALERT_OVERSEER: from ligo.overseer.overseer_client import send_to_overseer from multiprocessing import Process, Manager -log = logging.getLogger('gracedb.alert') def get_twilio_from(): for from_ in twilio_client.phone_numbers.iter(): @@ -104,12 +104,16 @@ def make_twilio_calls(event, twilio_recips, alert_type, **kwargs): # even be able to sign up with a phone number, but this is another # safety measure. if not is_external(recip.user): - log.info('calling %s', recip.user.username) - twilio_client.calls.create(recip.phone, from_, twiml_url, method='GET') + log.info('calling {0} at {1}' \ + .format(recip.user.username, recip.phone)) + twilio_client.calls.create(recip.phone, from_, twiml_url, + method='GET') else: - log.info('user %s is not an LVC member, call not made' % recip.user.username) + log.info('user {0} is not an LVC member, call not made' \ + .format(recip.user.username)) except: - log.exception('Failed to create call') + log.exception('Failed to create call to {0} at {1} ' \ + .format(recip.user.username, recip.phone)) def issueAlert(event, location, event_url, serialized_object=None): issueXMPPAlert(event, location, serialized_object=serialized_object) diff --git a/templates/gracedb/event_detail.html b/templates/gracedb/event_detail.html index 9740d01a0fe5899111ec0900c2ea7673f0fc873c..72cbd77b5d85d2187b7f3531feb6a4d6beb8dc13 100644 --- a/templates/gracedb/event_detail.html +++ b/templates/gracedb/event_detail.html @@ -86,8 +86,7 @@ {% endif %} </select></td></tr> <tr><th><label for="id_comment">Comment:</label></th><td> - <textarea cols="40" id="id_comment" name="comment" rows="10"> {{operator_signoff_object.comment}} - </textarea></td></tr> + <textarea cols="40" id="id_comment" name="comment" rows="10">{{operator_signoff_object.comment}}</textarea></td></tr> <input type="hidden" name="signoff_type" value="operator"> <input type="hidden" name="action" value="edit"> <tr> <th> Delete </th> <td> <input type="checkbox" name="delete" value="true"> </td> </tr> diff --git a/userprofile/views.py b/userprofile/views.py index df8cccbb6adeffab2962717380931f08d8db6b78..e05cd4898819079e896d1586a1bc1d562470665e 100644 --- a/userprofile/views.py +++ b/userprofile/views.py @@ -13,6 +13,9 @@ from django.db.models import Q from django_twilio.client import twilio_client import socket +# Set up logger +import logging +log = logging.getLogger(__name__) from .models import Trigger, Contact from .forms import ContactForm, triggerFormFactory @@ -179,9 +182,12 @@ def testContact(request, id): email = EmailMessage(subject, message, settings.SERVER_EMAIL, [c.email], []) email.send() + log.debug('Sent test e-mail to {0}'.format(c.email)) except: flash_msg += " Error sending test e-mail to {0}." \ .format(c.email) + log.exception('Error sending test e-mail to {0}'.format(c.email)) + if c.phone: # Send test phone alert try: @@ -193,8 +199,10 @@ def testContact(request, id): # Make call twilio_client.calls.create(c.phone, from_, twiml_url, method='GET') + log.debug('Making test call to {0}'.format(c.phone)) except: - flash_msg += " Error calling {0}.".format(c.phone) + flash_msg += " Error making test call to {0}.".format(c.phone) + log.exception('Error making test call to {0}'.format(c.phone)) request.session['flash_msg'] = flash_msg return index(request)