Log failure for the LUCStarter to start applications in DLT
authorJonathan Maw <jonathan.maw@codethink.co.uk>
Fri, 22 Jun 2012 13:56:09 +0000 (14:56 +0100)
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>
Fri, 22 Jun 2012 14:46:44 +0000 (15:46 +0100)
If the LUCStarter fails to start an application, it will log it as a
DLT_LOG_ERROR in DLT, instead of as a g_warning through GLib.

boot-manager/luc-starter.c

index 338af01..80614ae 100644 (file)
 #include <glib-object.h>
 #include <gio/gio.h>
 
+#include <dlt/dlt.h>
+
 #include <boot-manager/boot-manager-service.h>
 #include <boot-manager/luc-starter.h>
 #include <luc-handler/luc-handler-dbus.h>
 
 
 
+DLT_IMPORT_CONTEXT (boot_manager_context);
+
+
+
 /* property identifiers */
 enum
 {
@@ -307,6 +313,7 @@ luc_starter_start_app_finish (BootManagerService *service,
   LUCStarter  *starter = LUC_STARTER (user_data);
   GPtrArray   *group;
   gboolean     app_found = FALSE;
+  gchar       *message;
   guint        n;
 
   g_return_if_fail (BOOT_MANAGER_IS_SERVICE (service));
@@ -318,7 +325,12 @@ luc_starter_start_app_finish (BootManagerService *service,
 
   /* respond to errors */
   if (error != NULL)
-    g_warning ("start app had error: %s", error->message);
+    {
+      message = g_strdup_printf ("Failed to start the LUC application \"%s\": %s",
+                                 unit, error->message);
+      DLT_LOG (boot_manager_context, DLT_LOG_ERROR, DLT_STRING (message));
+      g_free (message);
+    }
 
   /* get the current start group */
   group_name = starter->start_order->data;
@@ -357,7 +369,7 @@ luc_starter_start_app_finish (BootManagerService *service,
   /* remove the association between an app and its cancellable, because the app has
    * finished starting, so cannot be cancelled any more */
   g_hash_table_remove (starter->cancellables, unit);
-  
+
   /* release the LUCStarter because the operation is finished */
   g_object_unref (starter);
 }