diff -r 8b363361ba55 -r 0180b538ed74 iro/anbieter/smstrade.py --- a/iro/anbieter/smstrade.py Fri Nov 27 01:07:44 2009 +0100 +++ b/iro/anbieter/smstrade.py Fri Nov 27 01:09:34 2009 +0100 @@ -21,6 +21,9 @@ import gsm0338 import urllib, httplib +import logging +logger=logging.getLogger("smstrade") + class UnknownStatusCode(Exception): def __init__(self,code): self.code=code @@ -88,8 +91,7 @@ def sendSMS(self,sms,recipients): """send SMS with $sms to $recipients""" - import logging - logging.debug('smstrade.sendSMS(%s,%s)'%(sms, str(recipients))) + logger.debug('smstrade.sendSMS(%s,%s)'%(sms, str(recipients))) sended = [] route = unicode(self.route) message = sms.content @@ -106,6 +108,7 @@ else: route=unicode("economy") smsSendStatus = self.__send(route, to, message, timestamp) + logger.debug('smstrade._send(...)=%i(%s)'%(int(smsSendStatus),str(smsSendStatus))) if int(smsSendStatus) in(100, 999): self.updateStatus(arranged=recipient) else: @@ -117,8 +120,7 @@ """ This function is the main part of the request to the sms service. The function has to return a unicode formated string that will represent the answer of the sms service to the request.""" - import logging - logging.debug('smstrade._send(%s,%s,%s,%s)'%( route, to, message, timestamp)) + logger.debug('smstrade._send(%s,%s,%s,%s)'%( route, to, message, timestamp)) parameters= {"key": self.key, "route": route, "to": to, @@ -135,7 +137,7 @@ parameters["concat_sms"] = "1" if len(message) > 160 else "0" params = "&".join( ["%s=%s" % (urllib.quote(k),urllib.quote(v.encode("utf-8"))) for (k, v) in parameters.items()]) - logging.debug('smstrade._send-parameters:%s\n\t->%s'%(str(parameters), str(params)) ) + logger.debug('smstrade._send-parameters:%s\n\t->%s'%(str(parameters), str(params)) ) headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"} conn = httplib.HTTPConnection("%s:%i" % (self.gateway, self.gatewayPort))