[geary] Reduce the default amount of conversation logging substantially



commit f1ca4bb435c08db177eaac2026b248fc384d7dff
Author: Michael Gratton <mike vee net>
Date:   Fri Feb 8 10:35:14 2019 +1100

    Reduce the default amount of conversation logging substantially

 .../conversation-list/conversation-list-store.vala | 20 +++++-------
 src/engine/app/app-conversation-monitor.vala       | 38 ++++++++++++++--------
 2 files changed, 34 insertions(+), 24 deletions(-)
---
diff --git a/src/client/conversation-list/conversation-list-store.vala 
b/src/client/conversation-list/conversation-list-store.vala
index 1ef3fa09..44ce84bf 100644
--- a/src/client/conversation-list/conversation-list-store.vala
+++ b/src/client/conversation-list/conversation-list-store.vala
@@ -188,34 +188,32 @@ public class ConversationListStore : Gtk.ListStore {
             emails.add_all(yield do_get_previews_async(needing_previews));
         if (emails.size < 1)
             return;
-        
-        debug("Displaying %d previews for %s...", emails.size, conversation_monitor.base_folder.to_string());
+
         foreach (Geary.Email email in emails) {
             Geary.App.Conversation? conversation = conversation_monitor.get_by_email_identifier(email.id);
-            if (conversation != null)
+            // The conversation can be null if e.g. a search is
+            // changing quickly and the original has evaporated
+            // already.
+            if (conversation != null) {
                 set_preview_for_conversation(conversation, email);
-            else
-                debug("Couldn't find conversation for %s", email.id.to_string());
+            }
         }
-        debug("Displayed %d previews for %s", emails.size, conversation_monitor.base_folder.to_string());
     }
-    
+
     private async Gee.Collection<Geary.Email> do_get_previews_async(
         Gee.Collection<Geary.EmailIdentifier> emails_needing_previews) {
         Geary.Folder.ListFlags flags = (loading_local_only) ? Geary.Folder.ListFlags.LOCAL_ONLY
             : Geary.Folder.ListFlags.NONE;
         Gee.Collection<Geary.Email>? emails = null;
         try {
-            debug("Loading %d previews...", emails_needing_previews.size);
             emails = yield email_store.list_email_by_sparse_id_async(emails_needing_previews,
                 ConversationListStore.WITH_PREVIEW_FIELDS, flags, cancellable);
-            debug("Loaded %d previews...", emails_needing_previews.size);
         } catch (Error err) {
             // Ignore NOT_FOUND, as that's entirely possible when waiting for the remote to open
             if (!(err is Geary.EngineError.NOT_FOUND))
-                debug("Unable to fetch preview: %s", err.message);
+                warning("Unable to fetch preview: %s", err.message);
         }
-        
+
         return emails ?? new Gee.ArrayList<Geary.Email>();
     }
     
diff --git a/src/engine/app/app-conversation-monitor.vala b/src/engine/app/app-conversation-monitor.vala
index d9dd78af..513bed78 100644
--- a/src/engine/app/app-conversation-monitor.vala
+++ b/src/engine/app/app-conversation-monitor.vala
@@ -297,10 +297,6 @@ public class Geary.App.ConversationMonitor : BaseObject {
         this.base_folder.account.email_removed.connect(on_account_email_removed);
         this.base_folder.account.email_flags_changed.connect(on_account_email_flags_changed);
 
-        this.progress_monitor.start.connect(() => { debug("Monitor started"); });
-        this.progress_monitor.update.connect(() => { debug("Monitor progress"); });
-        this.progress_monitor.finish.connect(() => { debug("Monitor stopped"); });
-
         this.queue = new ConversationOperationQueue(this.progress_monitor);
         this.queue.operation_error.connect(on_operation_error);
         this.queue.add(new FillWindowOperation(this));
@@ -534,7 +530,10 @@ public class Geary.App.ConversationMonitor : BaseObject {
         }
 
         if (emails != null && !emails.is_empty) {
-            debug("Fetched %d relevant emails locally", emails.size);
+            Logging.debug(
+                Logging.Flag.CONVERSATIONS,
+                "Fetched %d relevant emails locally", emails.size
+            );
             yield process_email_async(emails, ProcessJobContext());
         }
     }
@@ -573,8 +572,11 @@ public class Geary.App.ConversationMonitor : BaseObject {
                 this.operation_cancellable
             );
             if (count == 0) {
-                debug("Evaporating conversation %s because it has no emails in %s",
-                      conversation.to_string(), this.base_folder.to_string());
+                Logging.debug(
+                    Logging.Flag.CONVERSATIONS,
+                    "Evaporating conversation %s because it has no emails in %s",
+                    conversation.to_string(), this.base_folder.to_string()
+                );
                 this.conversations.remove_conversation(conversation);
                 evaporated.add(conversation);
             }
@@ -862,10 +864,18 @@ public class Geary.App.ConversationMonitor : BaseObject {
                     Geary.EmailIdentifier? lowest = this.window_lowest;
                     if (lowest != null) {
                         if (lowest.natural_sort_comparator(id) < 0) {
-                            debug("Unflagging email %s for deletion resurrects conversation", 
id.to_string());
+                            Logging.debug(
+                                Logging.Flag.CONVERSATIONS,
+                                "Unflagging email %s for deletion resurrects conversation",
+                                id.to_string()
+                            );
                             inserted_ids.add(id);
                         } else {
-                            debug("Not resurrecting undeleted email %s outside of window", id.to_string());
+                            Logging.debug(
+                                Logging.Flag.CONVERSATIONS,
+                                "Not resurrecting undeleted email %s outside of window",
+                                id.to_string()
+                            );
                         }
                     }
                 }
@@ -883,13 +893,15 @@ public class Geary.App.ConversationMonitor : BaseObject {
             // Remove conversation if get_emails yields an empty collection -- this probably means
             // the conversation was deleted.
             if (conversation.get_emails(Geary.App.Conversation.Ordering.NONE).size == 0) {
-                debug("Flagging email %s for deletion evaporates conversation %s", 
-                    id.to_string(), conversation.to_string());
-                
+                Logging.debug(
+                    Logging.Flag.CONVERSATIONS,
+                    "Flagging email %s for deletion evaporates conversation %s",
+                    id.to_string(), conversation.to_string()
+                );
                 this.conversations.remove_conversation(conversation);
                 removed_conversations.add(conversation);
                 removed_ids.add(id);
-            } 
+            }
         }
 
         // Notify about inserted messages


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]