[gvfs/sam/afc-monitor-logging] afc: Use g_message() and g_debug() instead of g_print() for log output



commit 8d26730c08e2eb79a0c439fe46099ee9f9e3ebb4
Author: Sam Thursfield <sam afuera me uk>
Date:   Tue Aug 6 21:19:57 2019 +0200

    afc: Use g_message() and g_debug() instead of g_print() for log output
    
    Daemons shouldn't be printing directly to stdout, but should be using
    the normal GLib logging system. The messages output by this daemon
    can now optionally be prefixed by process name when
    `G_MESSAGE_PREFIXED=all` is set in the environment, which allows them
    to be identified and filtered more easily in log output from the D-Bus
    daemon.

 monitor/afc/afcvolume.c        | 2 +-
 monitor/afc/afcvolumemonitor.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/monitor/afc/afcvolume.c b/monitor/afc/afcvolume.c
index 5f52cf16..319e1dfe 100644
--- a/monitor/afc/afcvolume.c
+++ b/monitor/afc/afcvolume.c
@@ -334,7 +334,7 @@ g_vfs_afc_volume_mount (GVolume             *volume,
   ActivationMountOp *data;
   GFile *root;
 
-  g_print ("g_vfs_afc_volume_mount (can_mount=%d uuid=%s)\n",
+  g_debug ("g_vfs_afc_volume_mount (can_mount=%d uuid=%s)",
            g_vfs_afc_volume_can_mount (volume),
            afc_volume->uuid);
 
diff --git a/monitor/afc/afcvolumemonitor.c b/monitor/afc/afcvolumemonitor.c
index ad9007c5..ddc225fc 100644
--- a/monitor/afc/afcvolumemonitor.c
+++ b/monitor/afc/afcvolumemonitor.c
@@ -26,7 +26,7 @@ g_vfs_afc_monitor_create_volume (GVfsAfcVolumeMonitor *self,
 {
   GVfsAfcVolume *volume = NULL;
 
-  g_print ("creating volume for device uuid '%s'\n", uuid);
+  g_message ("creating volume for device uuid '%s'\n", uuid);
 
   /* Only add the house arrest volume, the default AFC service
    * doesn't contain anything that users should modify */
@@ -63,7 +63,7 @@ g_vfs_afc_monitor_remove_volume (GVfsAfcVolumeMonitor *self,
   volume = find_volume_by_uuid (self, uuid);
   while (volume != NULL)
     {
-      g_print ("removing volume for device uuid '%s'\n", uuid);
+      g_message ("removing volume for device uuid '%s'\n", uuid);
       self->volumes = g_list_remove (self->volumes, volume);
       g_signal_emit_by_name (self, "volume-removed", volume);
       g_object_unref (volume);
@@ -102,7 +102,7 @@ g_vfs_afc_volume_monitor_constructor (GType type, guint ncps,
 
   idevice_event_subscribe(g_vfs_afc_monitor_idevice_event, self);
 
-  g_print ("Volume monitor alive\n");
+  g_message ("Volume monitor alive\n");
 
   return G_OBJECT(self);
 }


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