[Spice-devel] [PATCH spice-gtk 2/2] logging: use more idiomatic spice-gtk logging

Marc-André Lureau marcandre.lureau at gmail.com
Fri Mar 11 17:15:09 UTC 2016


spice-gtk uses SPICE_DEBUG for debug lines (for now), and prefer direct
glib glog/g_warning.

Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
---
 src/channel-main.c  | 8 ++++----
 src/spice-audio.c   | 2 +-
 src/spice-channel.c | 8 ++++----
 src/spice-pulse.c   | 4 ++--
 src/spice-session.c | 8 ++++----
 5 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/channel-main.c b/src/channel-main.c
index 06dd121..5c9e54f 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -1213,8 +1213,8 @@ static void audio_playback_volume_info_cb(GObject *object, GAsyncResult *res, gp
                                                       &volume, &error);
     if (ret == FALSE || volume == NULL || nchannels == 0) {
         if (error != NULL) {
-            spice_warning("Failed to get playback async volume info: %s", error->message);
-            g_error_free (error);
+            g_warning("Failed to get playback async volume info: %s", error->message);
+            g_error_free(error);
         } else {
             SPICE_DEBUG("Failed to get playback async volume info");
         }
@@ -1270,8 +1270,8 @@ static void audio_record_volume_info_cb(GObject *object, GAsyncResult *res, gpoi
     ret = spice_audio_get_record_volume_info_finish(audio, res, &mute, &nchannels, &volume, &error);
     if (ret == FALSE || volume == NULL || nchannels == 0) {
         if (error != NULL) {
-            spice_warning ("Failed to get record async volume info: %s", error->message);
-            g_error_free (error);
+            g_warning("Failed to get record async volume info: %s", error->message);
+            g_error_free(error);
         } else {
             SPICE_DEBUG("Failed to get record async volume info");
         }
diff --git a/src/spice-audio.c b/src/spice-audio.c
index 64d9bca..0087a0c 100644
--- a/src/spice-audio.c
+++ b/src/spice-audio.c
@@ -169,7 +169,7 @@ static void update_audio_channels(SpiceAudio *self, SpiceSession *session)
     GList *list, *tmp;
 
     if (!spice_session_get_audio_enabled(session)) {
-        g_debug("FIXME: disconnect audio channels");
+        SPICE_DEBUG("FIXME: disconnect audio channels");
         return;
     }
 
diff --git a/src/spice-channel.c b/src/spice-channel.c
index 7eda96a..d8a4ed6 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -2116,7 +2116,7 @@ SpiceChannel *spice_channel_new(SpiceSession *s, int type, int id)
     case SPICE_CHANNEL_PLAYBACK:
     case SPICE_CHANNEL_RECORD: {
         if (!spice_session_get_audio_enabled(s)) {
-            g_debug("audio channel is disabled, not creating it");
+            SPICE_DEBUG("audio channel is disabled, not creating it");
             return NULL;
         }
         gtype = type == SPICE_CHANNEL_RECORD ?
@@ -2126,7 +2126,7 @@ SpiceChannel *spice_channel_new(SpiceSession *s, int type, int id)
 #ifdef USE_SMARTCARD
     case SPICE_CHANNEL_SMARTCARD: {
         if (!spice_session_get_smartcard_enabled(s)) {
-            g_debug("smartcard channel is disabled, not creating it");
+            SPICE_DEBUG("smartcard channel is disabled, not creating it");
             return NULL;
         }
         gtype = SPICE_TYPE_SMARTCARD_CHANNEL;
@@ -2136,7 +2136,7 @@ SpiceChannel *spice_channel_new(SpiceSession *s, int type, int id)
 #ifdef USE_USBREDIR
     case SPICE_CHANNEL_USBREDIR: {
         if (!spice_session_get_usbredir_enabled(s)) {
-            g_debug("usbredir channel is disabled, not creating it");
+            SPICE_DEBUG("usbredir channel is disabled, not creating it");
             return NULL;
         }
         gtype = SPICE_TYPE_USBREDIR_CHANNEL;
@@ -2153,7 +2153,7 @@ SpiceChannel *spice_channel_new(SpiceSession *s, int type, int id)
         gtype = SPICE_TYPE_PORT_CHANNEL;
         break;
     default:
-        g_debug("unsupported channel kind: %s: %d",
+        SPICE_DEBUG("unsupported channel kind: %s: %d",
                 spice_channel_type_to_string(type), type);
         return NULL;
     }
diff --git a/src/spice-pulse.c b/src/spice-pulse.c
index 22db893..553dfda 100644
--- a/src/spice-pulse.c
+++ b/src/spice-pulse.c
@@ -690,11 +690,11 @@ static void playback_min_latency_changed(GObject *object, GParamSpec *pspec, gpo
     p->target_delay = min_latency;
 
     if (p->last_delay < p->target_delay) {
-        spice_debug("%s: corking", __FUNCTION__);
+        SPICE_DEBUG("%s: corking", __FUNCTION__);
         if (p->playback.stream)
             stream_cork(pulse, &p->playback, FALSE);
     } else {
-        spice_debug("%s: not corking. The current delay satisfies the requirement", __FUNCTION__);
+        SPICE_DEBUG("%s: not corking. The current delay satisfies the requirement", __FUNCTION__);
     }
 }
 
diff --git a/src/spice-session.c b/src/spice-session.c
index 249e2d1..f77487a 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -506,7 +506,7 @@ static int spice_parse_uri(SpiceSession *session, const char *original_uri)
 
         int len;
         if (sscanf(query, "%31[-a-zA-Z0-9]=%n", key, &len) != 1) {
-            spice_warning("Failed to parse key in URI '%s'", query);
+            g_warning("Failed to parse key in URI '%s'", query);
             goto fail;
         }
 
@@ -521,7 +521,7 @@ static int spice_parse_uri(SpiceSession *session, const char *original_uri)
         }
 
         if (sscanf(query, "%127[^;&]%n", value, &len) != 1) {
-            spice_warning("Failed to parse value of key '%s' in URI '%s'", key, query);
+            g_warning("Failed to parse value of key '%s' in URI '%s'", key, query);
             goto fail;
         }
 
@@ -2178,7 +2178,7 @@ GSocketConnection* spice_session_channel_open_host(SpiceSession *session, SpiceC
     } else {
         port = *use_tls ? s->tls_port : s->port;
         if (port == NULL) {
-            g_debug("Missing port value, not attempting %s connection.",
+            SPICE_DEBUG("Missing port value, not attempting %s connection.",
                     *use_tls?"TLS":"unencrypted");
             return NULL;
         }
@@ -2730,7 +2730,7 @@ PhodavServer* spice_session_get_webdav_server(SpiceSession *session)
 
     const gchar *shared_dir = spice_session_get_shared_dir(session);
     if (shared_dir == NULL) {
-        g_debug("No shared dir set, not creating webdav server");
+        SPICE_DEBUG("No shared dir set, not creating webdav server");
         return NULL;
     }
 
-- 
2.5.0



More information about the Spice-devel mailing list