[tracker/duplicates: 4/4] Improve logs



commit 405358481f52c440bb95a042d6e964234bbbc15c
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Fri Jul 23 10:09:49 2010 +0200

    Improve logs

 src/libtracker-miner/tracker-miner-fs.c |   48 +++++++++++++++++-------------
 1 files changed, 27 insertions(+), 21 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index a5b38e3..dd00e60 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -38,16 +38,16 @@
 /* If defined will print contents of populated mtime cache while running */
 #define PRINT_MTIME_CACHE_CONTENTS 1
 /* If defined, will dump paranoic debug logs */
-#define PARANOIC_DEBUG_LOGS 1
+#define PARANOIC_DEBUG 1
 
 
-#ifdef PARANOIC_DEBUG_LOGS
+#ifdef PARANOIC_DEBUG
 #define paranoic_debug(message, ...)	  \
 	g_debug ("***PARANOIC***:%s:%d: " message, \
 	         __FILE__, __LINE__, ##__VA_ARGS__)
 #else
 #define paranoic_debug(...)
-#endif /* PARANOIC_DEBUG_LOGS */
+#endif /* PARANOIC_DEBUG */
 
 
 /**
@@ -612,8 +612,11 @@ process_data_new (GFile                *file,
 	{
 		gchar *uri = g_file_get_uri (file);
 
-		paranoic_debug ("Created data to process %p, for URI '%s' with urn '%s'",
-		                data, uri, urn ? urn : "unknown");
+		paranoic_debug ("Created data to process %p, for URI '%s' with urn '%s', parent_urn '%s'",
+		                data,
+		                uri,
+		                urn ? urn : "unknown",
+		                parent_urn ? parent_urn : "unknown");
 		g_free (uri);
 	}
 #endif /* PARANOIC_DEBUG */
@@ -657,13 +660,6 @@ process_data_find (TrackerMinerFS *fs,
 			 * pointer equality here, rather than doing path comparisons
 			 */
 			if(data->file == file) {
-#ifdef PARANOIC_DEBUG
-				gchar *uri = g_file_get_uri (file);
-
-				paranoic_debug ("Found data to process '%p', looking for file '%p' (%s)",
-				                data, file, uri);
-				g_free (uri);
-#endif /* PARANOIC_DEBUG */
 				return data;
 			}
 		} else {
@@ -673,13 +669,6 @@ process_data_find (TrackerMinerFS *fs,
 			 * the same GFile as the one as input, use the
 			 * process_data_find() method instead */
 			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 /* PARANOIC_DEBUG */
 				return data;
 			}
 		}
@@ -1603,6 +1592,21 @@ item_add_or_update (TrackerMinerFS *fs,
 
 	urn = iri_cache_lookup (fs, file);
 
+	/* Check if we are trying to update/create a file where its parent still
+	 * doesn't exist */
+	if (parent && !parent_urn) {
+		gchar *uri;
+		gchar *parent_uri;
+
+		uri = g_file_get_uri (file);
+		parent_uri = g_file_get_uri (parent);
+
+		g_warning ("Adding to process item '%s' where parent '%s' still "
+		           "doesn't exist in store...", uri, parent_uri);
+		g_free (uri);
+		g_free (parent_uri);
+	}
+
 	data = process_data_new (file, urn, parent_urn, cancellable, sparql);
 	priv->processing_pool = g_list_prepend (priv->processing_pool, data);
 
@@ -1610,10 +1614,12 @@ item_add_or_update (TrackerMinerFS *fs,
 	{
 		gchar *uri = g_file_get_uri (file);
 
-		paranoic_debug ("New processing data added (%p) for file '%s' with urn '%s'",
+		paranoic_debug ("New processing data added (%p) for file '%s' with "
+		                "urn '%s' and parent_urn '%s'",
 		                data,
 		                uri,
-		                urn ? urn : "unknown");
+		                urn ? urn : "unknown",
+		                parent_urn ? parent_urn : "unknown");
 		g_free (uri);
 	}
 #endif /* PARANOIC_DEBUG */



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