[gvfs] google: Added "GVFS_GOOGLE_DEBUG" env var to log all the entries in cache



commit 37230cef0f44e0c144bdfd0c8431a40751419028
Author: Mayank Sharma <mayank8019 gmail com>
Date:   Sun Aug 18 03:01:49 2019 +0530

    google: Added "GVFS_GOOGLE_DEBUG" env var to log all the entries in cache
    
    To better check the state of cache before and after a copy operation is
    performed, we have added a function which checks for "DEBUG_CACHE"
    environment variable (any value) and logs all the entries to console.

 daemon/gvfsbackendgoogle.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
---
diff --git a/daemon/gvfsbackendgoogle.c b/daemon/gvfsbackendgoogle.c
index 094ffe0d..05031874 100644
--- a/daemon/gvfsbackendgoogle.c
+++ b/daemon/gvfsbackendgoogle.c
@@ -163,6 +163,41 @@ entries_in_folder_equal (gconstpointer a, gconstpointer b)
 
 /* ---------------------------------------------------------------------------------------------------- */
 
+static void
+log_dir_entries (GVfsBackendGoogle *self)
+{
+  GHashTableIter iter;
+  GDataEntry *entry;
+  DirEntriesKey *key;
+  GList *l;
+
+  if (!g_getenv ("GVFS_GOOGLE_DEBUG"))
+    return;
+
+  g_hash_table_iter_init (&iter, self->dir_entries);
+  while (g_hash_table_iter_next (&iter, (gpointer *) &key, (gpointer *) &entry))
+    {
+      g_debug ("  Real ID = %s, (%s, %s) -> %p, %d\n",
+               gdata_entry_get_id (GDATA_ENTRY (entry)),
+               key->title_or_id,
+               key->parent_id,
+               entry,
+               ((GObject *) entry)->ref_count);
+    }
+
+  for (l = self->dir_collisions; l != NULL; l = l->next)
+    {
+      entry = GDATA_ENTRY (l->data);
+      g_debug ("* Real ID = %s, (%s) -> %p, %d\n",
+               gdata_entry_get_id (entry),
+               gdata_entry_get_title (entry),
+               entry,
+               ((GObject *) entry)->ref_count);
+    }
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
 static WriteHandle *
 write_handle_new (GDataEntry *document, GDataUploadStream *stream, const gchar *filename, const gchar 
*entry_path)
 {


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