[tracker/rss-enclosures] libtracker-miner: Cleaned up logging



commit 5600deea3e6ee4f09ecc5afbf895445ec5f002aa
Author: Martyn Russell <martyn lanedo com>
Date:   Mon Jun 14 15:27:37 2010 +0100

    libtracker-miner: Cleaned up logging
    
    Be a bit more consistent and don't duplicate log data in places

 src/libtracker-miner/tracker-miner-fs.c     |   13 ++++---
 src/libtracker-miner/tracker-miner-object.c |    7 ++--
 src/miners/fs/tracker-miner-files.c         |   45 ++++++++++++++++++---------
 3 files changed, 41 insertions(+), 24 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 1a69ec7..38d8763 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -127,7 +127,7 @@ struct TrackerMinerFSPrivate {
 	GFile          *current_parent;
 	gchar          *current_parent_urn;
 
-	/* Folder contents' mtime cache */
+	/* URI mtime cache */
 	GHashTable     *mtime_cache;
 
 	/* File -> iri cache */
@@ -1222,7 +1222,7 @@ ensure_iri_cache (TrackerMinerFS *fs,
 
 	uri = g_file_get_uri (parent);
 
-	g_debug ("Generating IRI cache for folder: %s", uri);
+	g_debug ("Generating children cache for URI '%s'", uri);
 
 	query = g_strdup_printf ("SELECT ?url ?u { "
 	                         "  ?u nfo:belongsToContainer ?p ; "
@@ -1500,7 +1500,7 @@ item_remove (TrackerMinerFS *fs,
 	         uri);
 
 	if (!item_query_exists (fs, file, NULL, &mime)) {
-		g_debug ("  File does not exist anyway (uri:'%s')", uri);
+		g_debug ("  File does not exist anyway (uri '%s')", uri);
 		g_free (uri);
 		g_free (mime);
 		return TRUE;
@@ -2354,7 +2354,7 @@ ensure_mtime_cache (TrackerMinerFS *fs,
 	if (parent) {
 		uri = g_file_get_uri (parent);
 
-		g_debug ("Generating mtime cache for folder: '%s'", uri);
+		g_debug ("Generating mtime cache for URI '%s'", uri);
 
 		query = g_strdup_printf ("SELECT ?url ?last { ?u nfo:belongsToContainer ?p ; "
 		                                                "nie:url ?url ; "
@@ -2378,14 +2378,15 @@ ensure_mtime_cache (TrackerMinerFS *fs,
 		/* File is a crawl directory itself, query its mtime directly */
 		uri = g_file_get_uri (file);
 
-		g_debug ("Folder '%s' is a crawl directory, generating mtime cache for it", uri);
+		g_debug ("Generating mtime cache for URI '%s' (config location)", uri);
 
 		query = g_strdup_printf ("SELECT ?url ?last "
 		                         "WHERE { "
 		                         "  ?u nfo:fileLastModified ?last ; "
 		                         "     nie:url ?url ; "
 		                         "     nie:url \"%s\" "
-		                         "}", uri);
+		                         "}", 
+					 uri);
 		g_free (uri);
 
 		tracker_miner_execute_sparql (TRACKER_MINER (fs),
diff --git a/src/libtracker-miner/tracker-miner-object.c b/src/libtracker-miner/tracker-miner-object.c
index 33827b8..466e54c 100644
--- a/src/libtracker-miner/tracker-miner-object.c
+++ b/src/libtracker-miner/tracker-miner-object.c
@@ -440,7 +440,8 @@ store_name_monitor_cb (TrackerMiner *miner,
 {
 	GError *error = NULL;
 
-	g_debug ("Tracker-store availability has changed to %d", available);
+	g_debug ("Store availability has changed to %s", 
+		 available ? "AVAILABLE" : "UNAVAILABLE");
 
 	if (available && miner->private->availability_cookie != 0) {
 		tracker_miner_resume (miner,
@@ -448,7 +449,7 @@ store_name_monitor_cb (TrackerMiner *miner,
 		                      &error);
 
 		if (error) {
-			g_warning ("Error happened resuming miner: %s\n", error->message);
+			g_warning ("Error happened resuming miner, %s", error->message);
 			g_error_free (error);
 		}
 
@@ -461,7 +462,7 @@ store_name_monitor_cb (TrackerMiner *miner,
 		                                 &error);
 
 		if (error) {
-			g_warning ("Could not pause: %s", error->message);
+			g_warning ("Could not pause, %s", error->message);
 			g_error_free (error);
 		} else {
 			miner->private->availability_cookie = cookie_id;
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index 916d36d..c7a303f 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -548,15 +548,16 @@ set_up_mount_point_cb (GObject      *source,
                        gpointer      user_data)
 {
 	gchar *removable_device_urn = user_data;
-
 	GError *error = NULL;
+
 	tracker_miner_execute_update_finish (TRACKER_MINER (source),
 	                                     result,
 	                                     &error);
 
 	if (error) {
-		g_critical ("Could not set up mount point '%s': %s",
-		            removable_device_urn, error->message);
+		g_critical ("Could not set mount point in database '%s', %s",
+		            removable_device_urn, 
+			    error->message);
 		g_error_free (error);
 	}
 
@@ -572,8 +573,7 @@ set_up_mount_point (TrackerMinerFiles *miner,
 {
 	GString *queries;
 
-	g_debug ("Setting mount point '%s' state in database (URN '%s')",
-	         mount_point,
+	g_debug ("Mount point state being set in DB for URN '%s'",
 	         removable_device_urn);
 
 	queries = g_string_new (NULL);
@@ -769,18 +769,33 @@ query_mount_points_cb (GObject      *source,
 
 			if (urn) {
 				if (mount_point) {
-					g_debug ("URN '%s' (mount point: %s) was not reported to be mounted, but now it is, updating state",
-					         urn, mount_point);
+					g_debug ("Mount point state incorrect in DB for URN '%s', "
+						 "currently it is mounted on '%s'",
+					         urn,
+						 mount_point);
 				} else {
-					g_debug ("URN '%s' was not reported to be mounted, but now it is, updating state", urn);
+					g_debug ("Mount point state incorrect in DB for URN '%s', "
+						 "currently it is mounted",
+					         urn);
 				}
-				set_up_mount_point (TRACKER_MINER_FILES (miner), urn, mount_point, TRUE, accumulator);
+
+				set_up_mount_point (TRACKER_MINER_FILES (miner),
+						    urn,
+						    mount_point,
+						    TRUE,
+						    accumulator);
 			}
 		} else if (!(state & VOLUME_MOUNTED) &&
 		           (state & VOLUME_MOUNTED_IN_STORE)) {
 			if (urn) {
-				g_debug ("URN '%s' was reported to be mounted, but it isn't anymore, updating state", urn);
-				set_up_mount_point (TRACKER_MINER_FILES (miner), urn, NULL, FALSE, accumulator);
+				g_debug ("Mount pont state incorrect in DB for URN '%s', "
+					 "currently it is NOT mounted", 
+					 urn);
+				set_up_mount_point (TRACKER_MINER_FILES (miner),
+						    urn,
+						    NULL,
+						    FALSE,
+						    accumulator);
 			}
 		}
 	}
@@ -820,9 +835,9 @@ mount_point_removed_cb (TrackerStorage *storage,
 	gchar *urn;
 	GFile *mount_point_file;
 
-	g_debug ("Removing mount point '%s'", mount_point);
-
 	urn = g_strdup_printf (TRACKER_DATASOURCE_URN_PREFIX "%s", uuid);
+	g_debug ("Mount point removed for URN '%s'", urn);
+
 	mount_point_file = g_file_new_for_path (mount_point);
 
 	/* Set mount point status in tracker-store */
@@ -855,7 +870,8 @@ mount_point_added_cb (TrackerStorage *storage,
 	index_removable_devices = tracker_config_get_index_removable_devices (priv->config);
 	index_optical_discs = tracker_config_get_index_optical_discs (priv->config);
 
-	g_message ("Added mount point '%s'", mount_point);
+	urn = g_strdup_printf (TRACKER_DATASOURCE_URN_PREFIX "%s", uuid);
+	g_message ("Mount point added for URN '%s'", urn);
 
 	if (removable && !index_removable_devices) {
 		g_message ("  Not crawling, removable devices disabled in config");
@@ -940,7 +956,6 @@ mount_point_added_cb (TrackerStorage *storage,
 		g_object_unref (file);
 	}
 
-	urn = g_strdup_printf (TRACKER_DATASOURCE_URN_PREFIX "%s", uuid);
 	set_up_mount_point (miner, urn, mount_point, TRUE, NULL);
 	g_free (urn);
 }



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