Switched to module level loggers
[gc-dialer] / src / gv_backend.py
index 0e5da67..4d6e19c 100644 (file)
@@ -46,6 +46,7 @@ except ImportError:
        simplejson = None
 
 
+_moduleLogger = logging.getLogger("gv_backend")
 _TRUE_REGEX = re.compile("true")
 _FALSE_REGEX = re.compile("false")
 
@@ -133,7 +134,7 @@ class GVDialer(object):
                try:
                        self._grab_account_info()
                except Exception, e:
-                       logging.exception(str(e))
+                       _moduleLogger.exception(str(e))
                        return False
 
                self._browser.cookies.save()
@@ -162,7 +163,7 @@ class GVDialer(object):
                try:
                        loginSuccessOrFailurePage = self._browser.download(self._loginURL, loginPostData)
                except urllib2.URLError, e:
-                       logging.exception(str(e))
+                       _moduleLogger.exception(str(e))
                        raise RuntimeError("%s is not accesible" % self._loginURL)
 
                return self.is_authed()
@@ -193,7 +194,7 @@ class GVDialer(object):
                        }
                        callSuccessPage = self._browser.download(self._clicktocallURL, clickToCallData, None, otherData)
                except urllib2.URLError, e:
-                       logging.exception(str(e))
+                       _moduleLogger.exception(str(e))
                        raise RuntimeError("%s is not accesible" % self._clicktocallURL)
 
                if self._gvDialingStrRe.search(callSuccessPage) is None:
@@ -218,7 +219,7 @@ class GVDialer(object):
                        }
                        smsSuccessPage = self._browser.download(self._sendSmsURL, smsData, None, otherData)
                except urllib2.URLError, e:
-                       logging.exception(str(e))
+                       _moduleLogger.exception(str(e))
                        raise RuntimeError("%s is not accesible" % self._sendSmsURL)
 
                return True
@@ -339,7 +340,7 @@ class GVDialer(object):
                                try:
                                        contactsPage = self._browser.download(contactsPageUrl)
                                except urllib2.URLError, e:
-                                       logging.exception(str(e))
+                                       _moduleLogger.exception(str(e))
                                        raise RuntimeError("%s is not accesible" % contactsPageUrl)
                                for contact_match in self._contactsRe.finditer(contactsPage):
                                        contactId = contact_match.group(1)
@@ -366,7 +367,7 @@ class GVDialer(object):
                try:
                        detailPage = self._browser.download(self._contactDetailURL + '/' + contactId)
                except urllib2.URLError, e:
-                       logging.exception(str(e))
+                       _moduleLogger.exception(str(e))
                        raise RuntimeError("%s is not accesible" % self._contactDetailURL)
 
                for detail_match in self._contactDetailPhoneRe.finditer(detailPage):
@@ -381,7 +382,7 @@ class GVDialer(object):
                try:
                        voicemailPage = self._browser.download(self._voicemailURL)
                except urllib2.URLError, e:
-                       logging.exception(str(e))
+                       _moduleLogger.exception(str(e))
                        raise RuntimeError("%s is not accesible" % self._voicemailURL)
                voicemailHtml = self._grab_html(voicemailPage)
                parsedVoicemail = self._parse_voicemail(voicemailHtml)
@@ -390,7 +391,7 @@ class GVDialer(object):
                try:
                        smsPage = self._browser.download(self._smsURL)
                except urllib2.URLError, e:
-                       logging.exception(str(e))
+                       _moduleLogger.exception(str(e))
                        raise RuntimeError("%s is not accesible" % self._smsURL)
                smsHtml = self._grab_html(smsPage)
                parsedSms = self._parse_sms(smsHtml)
@@ -432,7 +433,7 @@ class GVDialer(object):
                if anGroup is not None:
                        self._accountNum = anGroup.group(1)
                else:
-                       logging.debug("Could not extract account number from GoogleVoice")
+                       _moduleLogger.debug("Could not extract account number from GoogleVoice")
 
                self._callbackNumbers = {}
                for match in self._callbackRe.finditer(page):
@@ -468,7 +469,7 @@ class GVDialer(object):
                        try:
                                flatXml = self._browser.download(url)
                        except urllib2.URLError, e:
-                               logging.exception(str(e))
+                               _moduleLogger.exception(str(e))
                                raise RuntimeError("%s is not accesible" % url)
 
                        allRecentHtml = self._grab_html(flatXml)