[tracker/duplicates: 1/4] libtracker-miner: Add some paranoic debug logs



commit fba7e5c13d81f4017af5cd317d1eb8087e6c6659
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Thu Jul 22 17:09:37 2010 +0200

    libtracker-miner: Add some paranoic debug logs

 src/libtracker-miner/tracker-miner-fs.c |   56 +++++++++++++++++++++++++++++-
 1 files changed, 54 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index a14ec4a..44a1860 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -37,6 +37,18 @@
 #undef PRINT_IRI_CACHE_CONTENTS
 /* If defined will print contents of populated mtime cache while running */
 #undef PRINT_MTIME_CACHE_CONTENTS
+/* If defined, will dump paranoic debug logs */
+#undef PARANOIC_DEBUG_LOGS
+
+
+#ifdef PARANOIC_DEBUG_LOGS
+#define paranoic_debug(message, ...)	  \
+	g_debug ("***PARANOIC***:%s:%d: " message, \
+	         __FILE__, __LINE__, ##__VA_ARGS__)
+#else
+#define paranoic_debug(...)
+#endif /* PARANOIC_DEBUG_LOGS */
+
 
 /**
  * SECTION:tracker-miner-fs
@@ -634,16 +646,27 @@ process_data_find (TrackerMinerFS *fs,
 			 * same GFile object that's being passed, so we check for
 			 * pointer equality here, rather than doing path comparisons
 			 */
-			if(data->file == file)
+			if(data->file == file) {
+				paranoic_debug ("Found data to process '%p', looking for file '%p'",
+				                data, file);
 				return data;
+			}
 		} else {
 			/* Note that if there are different GFiles being
 			 * processed for the same file path, we are actually
 			 * returning the first one found, If you want exactly
 			 * the same GFile as the one as input, use the
 			 * process_data_find() method instead */
-			if (g_file_equal (data->file, file))
+			if (g_file_equal (data->file, file)) {
+#ifdef PARANOIC_DEBUG
+				gchar *uri = g_file_get_uri (file);
+
+				paranoic_debug ("Found data to process '%p', looking for file '%s'",
+				                data, uri);
+				g_free (uri);
+#endif
 				return data;
+			}
 		}
 	}
 
@@ -1159,6 +1182,12 @@ item_query_exists (TrackerMinerFS  *miner,
 
 	g_main_loop_unref (data.main_loop);
 
+
+	paranoic_debug ("ITEM '%s' was %s FOUND in store (iri: %s)",
+	                uri,
+	                result ? "" : "NOT",
+	                data.iri ? data:iri : "none");
+
 	if (iri) {
 		*iri = data.iri;
 	} else {
@@ -1563,6 +1592,18 @@ item_add_or_update (TrackerMinerFS *fs,
 	data = process_data_new (file, urn, parent_urn, cancellable, sparql);
 	priv->processing_pool = g_list_prepend (priv->processing_pool, data);
 
+#ifdef PARANOIC_DEBUG
+	{
+		gchar *uri = g_file_get_uri (file);
+
+		paranoic_debug ("New processing data added (%p) for file '%s' with urn '%s'",
+		                data,
+		                uri,
+		                urn ? urn : "unknown");
+		g_free (uri);
+	}
+#endif /* PARANOIC_DEBUG */
+
 	if (do_process_file (fs, data)) {
 		guint length;
 
@@ -3598,6 +3639,17 @@ tracker_miner_fs_file_notify (TrackerMinerFS *fs,
 		return;
 	}
 
+#ifdef PARANOIC_DEBUG
+	{
+		gchar *uri = g_file_get_uri (file);
+
+		paranoic_debug ("NOTIFY for file '%s' received (urn: %s)",
+		                uri,
+		                data->urn ? data->urn : "unknown");
+		g_free (uri);
+	}
+#endif /* PARANOIC_DEBUG */
+
 	item_add_or_update_cb (fs, data, error);
 }
 



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