[tracker] all: Improve start/stop logging for all processes



commit 32f4b45fbb280dcc6a5ff3c260cd6a857892264b
Author: Martyn Russell <martyn lanedo com>
Date:   Fri Mar 8 16:06:33 2013 +0000

    all: Improve start/stop logging for all processes
    
    Now we have Starting/Stopping in the log_init/shutdown functions not just the
    process and version.
    
    We also only print the log filename if we're writing to a log file at all.
    
    We now don't print to stdout that we're initializing either.
    
    The TrackerConfigFile g_message() line about which file we're "monitoring" is
    removed too, this was always the first line and quite redundant anyway now we
    use gsettings.

 src/libtracker-common/tracker-config-file.c |    3 ---
 src/libtracker-common/tracker-log.c         |    4 +++-
 src/miners/fs/tracker-main.c                |    8 ++++----
 src/miners/rss/tracker-main.c               |    6 ++++--
 src/tracker-extract/tracker-main.c          |   16 +++++++---------
 src/tracker-store/tracker-main.vala         |    6 +++---
 src/tracker-writeback/tracker-main.c        |    6 ++++--
 7 files changed, 25 insertions(+), 24 deletions(-)
---
diff --git a/src/libtracker-common/tracker-config-file.c b/src/libtracker-common/tracker-config-file.c
index 0bbe850..80bcde5 100644
--- a/src/libtracker-common/tracker-config-file.c
+++ b/src/libtracker-common/tracker-config-file.c
@@ -306,9 +306,6 @@ config_load (TrackerConfigFile *file)
        }
 
        if (!file->monitor) {
-               g_message ("Setting up monitor for changes to config file:'%s'",
-                          filename);
-
                file->monitor = g_file_monitor_file (file->file,
                                                     G_FILE_MONITOR_NONE,
                                                     NULL,
diff --git a/src/libtracker-common/tracker-log.c b/src/libtracker-common/tracker-log.c
index 9a4661e..0eadbac 100644
--- a/src/libtracker-common/tracker-log.c
+++ b/src/libtracker-common/tracker-log.c
@@ -292,7 +292,7 @@ tracker_log_init (gint    this_verbosity,
        initialized = TRUE;
 
        /* log binary name and version */
-       g_message ("%s %s", g_get_application_name (), PACKAGE_VERSION);
+       g_message ("Starting %s %s", g_get_application_name (), PACKAGE_VERSION);
 
        return TRUE;
 }
@@ -304,6 +304,8 @@ tracker_log_shutdown (void)
                return;
        }
 
+       g_message ("Stopping %s %s", g_get_application_name (), PACKAGE_VERSION);
+
        /* Reset default log handler */
        g_log_set_default_handler (g_log_default_handler, NULL);
 
diff --git a/src/miners/fs/tracker-main.c b/src/miners/fs/tracker-main.c
index 5ea2708..fb811e5 100644
--- a/src/miners/fs/tracker-main.c
+++ b/src/miners/fs/tracker-main.c
@@ -899,8 +899,6 @@ main (gint argc, gchar *argv[])
                return EXIT_SUCCESS;
        }
 
-       g_print ("Initializing tracker-miner-fs...\n");
-
        initialize_signal_handler ();
 
        /* Initialize logging */
@@ -916,8 +914,10 @@ main (gint argc, gchar *argv[])
 
        tracker_log_init (tracker_config_get_verbosity (config),
                          &log_filename);
-       g_print ("Starting log:\n  File:'%s'\n", log_filename);
-       g_free (log_filename);
+       if (log_filename) {
+               g_message ("Using log file:'%s'", log_filename);
+               g_free (log_filename);
+       }
 
        sanity_check_option_values (config);
 
diff --git a/src/miners/rss/tracker-main.c b/src/miners/rss/tracker-main.c
index e79d15f..1cd0406 100644
--- a/src/miners/rss/tracker-main.c
+++ b/src/miners/rss/tracker-main.c
@@ -151,8 +151,10 @@ main (int argc, char **argv)
        }
 
        tracker_log_init (verbosity, &log_filename);
-       g_print ("Starting log:\n  File:'%s'\n", log_filename);
-       g_free (log_filename);
+       if (log_filename != NULL) {
+               g_message ("Using log file:'%s'", log_filename);
+               g_free (log_filename);
+       }
 
        miner = tracker_miner_rss_new (&error);
        if (!miner) {
diff --git a/src/tracker-extract/tracker-main.c b/src/tracker-extract/tracker-main.c
index 7773ebe..e805ad7 100644
--- a/src/tracker-extract/tracker-main.c
+++ b/src/tracker-extract/tracker-main.c
@@ -370,13 +370,6 @@ main (int argc, char *argv[])
                return EXIT_SUCCESS;
        }
 
-       g_print ("Initializing tracker-extract...\n");
-
-       if (!filename) {
-               g_print ("  Shutdown after 30 seconds of inactivity is %s\n",
-                        disable_shutdown ? "disabled" : "enabled");
-       }
-
        initialize_signal_handler ();
 
        g_type_init ();
@@ -401,8 +394,13 @@ main (int argc, char *argv[])
        }
 
        tracker_log_init (tracker_config_get_verbosity (config), &log_filename);
-       g_print ("Starting log:\n  File:'%s'\n", log_filename);
-       g_free (log_filename);
+       if (log_filename != NULL) {
+               g_message ("Using log file:'%s'", log_filename);
+               g_free (log_filename);
+       }
+
+       g_message ("Shutdown after 30 seconds of inactivity is %s",
+                  disable_shutdown ? "disabled" : "enabled");
 
        sanity_check_option_values (config);
 
diff --git a/src/tracker-store/tracker-main.vala b/src/tracker-store/tracker-main.vala
index 61e6ac6..f8af0ac 100644
--- a/src/tracker-store/tracker-main.vala
+++ b/src/tracker-store/tracker-main.vala
@@ -183,8 +183,6 @@ License which can be viewed at:
                        return 0;
                }
 
-               print ("Initializing tracker-store...\n");
-
                initialize_signal_handler ();
 
                /* This makes sure we don't steal all the system's resources */
@@ -201,7 +199,9 @@ License which can be viewed at:
 
                /* Initialize other subsystems */
                Tracker.Log.init (config.verbosity, out log_filename);
-               print ("Starting log:\n  File:'%s'\n", log_filename);
+               if (log_filename != null) {
+                       message ("Using log file:'%s'", log_filename);
+               }
 
                sanity_check_option_values (config);
 
diff --git a/src/tracker-writeback/tracker-main.c b/src/tracker-writeback/tracker-main.c
index dc703ae..91c7685 100644
--- a/src/tracker-writeback/tracker-main.c
+++ b/src/tracker-writeback/tracker-main.c
@@ -117,8 +117,10 @@ main (int   argc,
 
        tracker_log_init (tracker_config_get_verbosity (config),
                          &log_filename);
-       g_print ("Starting log:\n  File:'%s'\n", log_filename);
-       g_free (log_filename);
+       if (log_filename != NULL) {
+               g_message ("Using log file:'%s'", log_filename);
+               g_free (log_filename);
+       }
 
        sanity_check_option_values (config);
 


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