Improving logging
authorEd Page <eopage@byu.net>
Thu, 14 Jan 2010 02:12:10 +0000 (20:12 -0600)
committerEd Page <eopage@byu.net>
Thu, 14 Jan 2010 02:12:10 +0000 (20:12 -0600)
src/channel/contact_list.py
src/channel/text.py

index a67fdc5..d247ec6 100644 (file)
@@ -90,6 +90,7 @@ class AllContactsListChannel(
                self._process_refresh(addressbook, added, removed)
 
        def _process_refresh(self, addressbook, added, removed):
+               _moduleLogger.info("Added: %r, Removed: %r" % (len(added), len(removed)))
                connection = self._conn
                handlesAdded = [
                        handle.create_handle(connection, "contact", contactId, phoneNumber)
index bcdacbe..64ee0be 100644 (file)
@@ -63,13 +63,13 @@ class TextChannel(telepathy.server.ChannelTypeText):
                try:
                        mergedConversations = self._conn.session.voicemails.get_conversation(self._contactKey)
                except KeyError:
-                       _moduleLogger.debug("Nothing in the conversation yet for %r" % (self._contactKey, ))
+                       _moduleLogger.debug("No voicemails in the conversation yet for %r" % (self._contactKey, ))
                else:
                        self._report_conversation(mergedConversations)
                try:
                        mergedConversations = self._conn.session.texts.get_conversation(self._contactKey)
                except KeyError:
-                       _moduleLogger.debug("Nothing in the conversation yet for %r" % (self._contactKey, ))
+                       _moduleLogger.debug("No texts conversation yet for %r" % (self._contactKey, ))
                else:
                        self._report_conversation(mergedConversations)
 
@@ -129,6 +129,11 @@ class TextChannel(telepathy.server.ChannelTypeText):
                # before the last one sent because that creates a race condition of two
                # people sending at about the same time, which happens quite a bit
                newConversations = mergedConversations.conversations
+               if not newConversations:
+                       _moduleLogger.debug(
+                               "No messages ended up existing for %r" % (self._contactKey, )
+                       )
+                       return
                newConversations = self._filter_out_reported(newConversations)
                newConversations = self._filter_out_read(newConversations)
                newConversations = list(newConversations)