Commits

Matthew Schinckel  committed 7e8f29d

Better logging.

  • Participants
  • Parent commits c587a36

Comments (0)

Files changed (1)

File sms/views.py

 
 from sms.models import Message, Gateway
 
+logger = logging.getLogger('sms-gateway')
+
 @csrf_exempt
 def update_delivery_status(request):
     logging.debug("Status update received.")
     msg = Message.objects.get_matching_message(data)
     
     if not msg:
-        logging.error("%s" % data)
-        logging.error("Message could not be found.")
+        logger.error("Message could not be found: %s" % data)
+        # Need to respond with OK, else remote server will keep trying.
         return HttpResponse('OK')
         
     logging.debug("Found message %i" % msg.pk)
     msg = Message.objects.get_original_for_reply(data)
     
     if not msg:
-        logging.error("%s" % data)
-        logging.error("Original message could not be found.")
+        logger.error("Original message could not be found: %s" % data)
         return HttpResponse('OK')
         
     logging.debug("Found message %i" % msg.pk)