[gnome-online-miners/sam/help-and-debug: 3/4] Add debug info on how many matching accounts a miner found



commit 0362638012c95c57bbdb1425c866e012a3369db2
Author: Sam Thursfield <ssssam gmail com>
Date:   Sun Sep 4 01:15:42 2016 +0100

    Add debug info on how many matching accounts a miner found
    
    This is sometimes useful when trying to figure out why a miner doesn't
    work.
    
    The messages are written with g_message(), thus they are only written
    to stdout when G_MESSAGES_DEBUG=all is set in the environment.
    
    Example output:
    
      Gom-Message: Found 2 account(s) of type 'facebook' in the GNOME Online Accounts database.

 src/gom-miner.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/gom-miner.c b/src/gom-miner.c
index aa39d14..19c3b4e 100644
--- a/src/gom-miner.c
+++ b/src/gom-miner.c
@@ -650,11 +650,13 @@ gom_miner_refresh_db_real (GomMiner *self)
   GList *accounts, *content_objects, *acc_objects, *l;
   GomMinerClass *miner_class = GOM_MINER_GET_CLASS (self);
   gboolean skip_photos, skip_documents;
+  gint n_accounts_with_correct_provider_type = 0;
 
   content_objects = NULL;
   acc_objects = NULL;
 
   accounts = goa_client_get_accounts (self->priv->client);
+
   for (l = accounts; l != NULL; l = l->next)
     {
       object = l->data;
@@ -667,6 +669,8 @@ gom_miner_refresh_db_real (GomMiner *self)
       if (g_strcmp0 (provider_type, miner_class->goa_provider_type) != 0)
         continue;
 
+      n_accounts_with_correct_provider_type ++;
+
       acc_objects = g_list_append (acc_objects, g_object_ref (object));
       skip_photos = skip_documents = TRUE;
 
@@ -680,11 +684,20 @@ gom_miner_refresh_db_real (GomMiner *self)
         skip_documents = FALSE;
 
       if (skip_photos && skip_documents)
-        continue;
+        {
+          g_message ("No matching content types for %s account %s",
+                     provider_type, goa_account_get_identity (account));
+          continue;
+        }
 
       content_objects = g_list_append (content_objects, g_object_ref (object));
     }
 
+  g_message ("Found %i account(s) of type '%s' in the GNOME Online Accounts "
+             "database.",
+             n_accounts_with_correct_provider_type,
+             miner_class->goa_provider_type);
+
   g_list_free_full (accounts, g_object_unref);
 
   gom_miner_cleanup_old_accounts (self, content_objects, acc_objects);


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