Skip to content
Snippets Groups Projects
Commit 0507b6be authored by Tanner Prestegard's avatar Tanner Prestegard Committed by Alexander Pace
Browse files

logging updates in two modules and fixing whitespace in advocate box

parent 38a773e1
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
......@@ -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>
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment