[Spice-devel] [PATCH spice-gtk] Use glib message logging functions

Pavel Grunt pgrunt at redhat.com
Mon Aug 8 16:44:40 UTC 2016


On Mon, 2016-08-08 at 18:27 +0200, Victor Toso wrote:
> Hi,
> 
> On Mon, Aug 08, 2016 at 06:19:13PM +0200, Pavel Grunt wrote:
> > 
> > On Mon, 2016-08-08 at 18:09 +0200, Victor Toso wrote:
> > > 
> > > Hi,
> > > 
> > > On Mon, Aug 08, 2016 at 06:03:08PM +0200, Pavel Grunt wrote:
> > > > 
> > > > 
> > > > Keep the same log domain
> > > 
> > > So, should we remove spice_* log functions?
> > I believe there is no need for them
> > 
> > From spice-gtk perspective:
> > g_warning produces GSpice-warning, spice_warning produces Spice-warning 
> 
> We could change G_LOG_DOMAIN for that
I don't think it is nice to mix styles.

We can of course change it other way and continue with
https://bugs.freedesktop.org/show_bug.cgi?id=91838

Pavel
> 
> > 
> > > 
> > > 
> > > I thought it would be the other way around so we could have more
> > > flexibility with our domains.
> > Are you suggesting g_log_structured ?
> 
> No, that could be done without spice log functions (I think).
> But we would lose SPICE_ABORT_LEVEL, SPICE_DEBUG_LEVEL (which is
> deprecated already?)
> 
> Don't know. If g_log_structured can be used without spice logging
> functions, then I would prefer using glib logging too, in the future.
> 
> Cheers,
> 
> 
> > 
> > 
> > Pavel
> > 
> > > 
> > > 
> > > > 
> > > > 
> > > > ---
> > > >  src/channel-display-gst.c | 16 ++++++++--------
> > > >  src/channel-main.c        |  6 +++---
> > > >  src/channel-usbredir.c    |  6 +++---
> > > >  3 files changed, 14 insertions(+), 14 deletions(-)
> > > > 
> > > > diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
> > > > index c752639..291d77c 100644
> > > > --- a/src/channel-display-gst.c
> > > > +++ b/src/channel-display-gst.c
> > > > @@ -103,26 +103,26 @@ static gboolean display_frame(gpointer
> > > > video_decoder)
> > > >      g_return_val_if_fail(frame, G_SOURCE_REMOVE);
> > > >  
> > > >      if (!frame->sample) {
> > > > -        spice_warning("got a frame without a sample!");
> > > > +        g_warning("got a frame without a sample!");
> > > >          goto error;
> > > >      }
> > > >  
> > > >      caps = gst_sample_get_caps(frame->sample);
> > > >      if (!caps) {
> > > > -        spice_warning("GStreamer error: could not get the caps of the
> > > > sample");
> > > > +        g_warning("GStreamer error: could not get the caps of the
> > > > sample");
> > > >          goto error;
> > > >      }
> > > >  
> > > >      s = gst_caps_get_structure(caps, 0);
> > > >      if (!gst_structure_get_int(s, "width", &width) ||
> > > >          !gst_structure_get_int(s, "height", &height)) {
> > > > -        spice_warning("GStreamer error: could not get the size of the
> > > > frame");
> > > > +        g_warning("GStreamer error: could not get the size of the
> > > > frame");
> > > >          goto error;
> > > >      }
> > > >  
> > > >      buffer = gst_sample_get_buffer(frame->sample);
> > > >      if (!gst_buffer_map(buffer, &mapinfo, GST_MAP_READ)) {
> > > > -        spice_warning("GStreamer error: could not map the buffer");
> > > > +        g_warning("GStreamer error: could not map the buffer");
> > > >          goto error;
> > > >      }
> > > >  
> > > > @@ -221,14 +221,14 @@ static GstFlowReturn new_sample(GstAppSink
> > > > *gstappsink, gpointer video_decoder)
> > > >              l = l->next;
> > > >          }
> > > >          if (!l) {
> > > > -            spice_warning("got an unexpected decoded buffer!");
> > > > +            g_warning("got an unexpected decoded buffer!");
> > > >              gst_sample_unref(sample);
> > > >          }
> > > >  
> > > >          g_mutex_unlock(&decoder->queues_mutex);
> > > >          schedule_frame(decoder);
> > > >      } else {
> > > > -        spice_warning("GStreamer error: could not pull sample");
> > > > +        g_warning("GStreamer error: could not pull sample");
> > > >      }
> > > >      return GST_FLOW_OK;
> > > >  }
> > > > @@ -300,7 +300,7 @@ static gboolean create_pipeline(SpiceGstDecoder
> > > > *decoder)
> > > >      decoder->pipeline = gst_parse_launch_full(desc, NULL,
> > > > GST_PARSE_FLAG_FATAL_ERRORS, &err);
> > > >      g_free(desc);
> > > >      if (!decoder->pipeline) {
> > > > -        spice_warning("GStreamer error: %s", err->message);
> > > > +        g_warning("GStreamer error: %s", err->message);
> > > >          g_clear_error(&err);
> > > >          return FALSE;
> > > >      }
> > > > @@ -440,7 +440,7 @@ static gboolean gstvideo_init(void)
> > > >          if (gst_init_check(NULL, NULL, &err)) {
> > > >              success = 1;
> > > >          } else {
> > > > -            spice_warning("Disabling GStreamer video support: %s", err-
> > > > > 
> > > > > message);
> > > > +            g_warning("Disabling GStreamer video support: %s", err-
> > > > > 
> > > > > message);
> > > >              g_clear_error(&err);
> > > >              success = -1;
> > > >          }
> > > > diff --git a/src/channel-main.c b/src/channel-main.c
> > > > index d9fd025..45cd6d4 100644
> > > > --- a/src/channel-main.c
> > > > +++ b/src/channel-main.c
> > > > @@ -2898,7 +2898,7 @@ static void
> > > > file_transfer_operation_free(FileTransferOperation *xfer_op)
> > > >      /* SpiceFileTransferTask itself is freed after it emits "finish" */
> > > >      g_hash_table_unref(xfer_op->xfer_task);
> > > >  
> > > > -    spice_debug("Freeing file-transfer-operation %p", xfer_op);
> > > > +    SPICE_DEBUG("Freeing file-transfer-operation %p", xfer_op);
> > > >      g_free(xfer_op);
> > > >  }
> > > >  
> > > > @@ -2915,8 +2915,8 @@ static void
> > > > spice_main_channel_reset_all_xfer_operations(SpiceMainChannel *chann
> > > >          GError *error;
> > > >  
> > > >          if (xfer_task == NULL) {
> > > > -            spice_warning("(reset-all) can't complete task %u -
> > > > completed
> > > > already?",
> > > > -                          GPOINTER_TO_UINT(key));
> > > > +            g_warning("(reset-all) can't complete task %u - completed
> > > > already?",
> > > > +                      GPOINTER_TO_UINT(key));
> > > >              continue;
> > > >          }
> > > >  
> > > > diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
> > > > index 0e7a0b0..796d6c0 100644
> > > > --- a/src/channel-usbredir.c
> > > > +++ b/src/channel-usbredir.c
> > > > @@ -812,7 +812,7 @@ static int
> > > > try_handle_compressed_msg(SpiceMsgCompressedData *compressed_data_msg
> > > >      char *decompressed = NULL;
> > > >  
> > > >      if (compressed_data_msg->uncompressed_size == 0) {
> > > > -        spice_warning("Invalid uncompressed_size");
> > > > +        g_warning("Invalid uncompressed_size");
> > > >          return FALSE;
> > > >      }
> > > >  
> > > > @@ -827,11 +827,11 @@ static int
> > > > try_handle_compressed_msg(SpiceMsgCompressedData *compressed_data_msg
> > > >          break;
> > > >  #endif
> > > >      default:
> > > > -        spice_warning("Unknown Compression Type");
> > > > +        g_warning("Unknown Compression Type");
> > > >          return FALSE;
> > > >      }
> > > >      if (decompressed_size != compressed_data_msg->uncompressed_size) {
> > > > -        spice_warning("Decompress Error decompressed_size=%d
> > > > expected=%u",
> > > > +        g_warning("Decompress Error decompressed_size=%d expected=%u",
> > > >                        decompressed_size, compressed_data_msg-
> > > > > 
> > > > > uncompressed_size);
> > > >          g_free(decompressed);
> > > >          return FALSE;
> > > > -- 
> > > > 2.9.2
> > > > 
> > > > _______________________________________________
> > > > Spice-devel mailing list
> > > > Spice-devel at lists.freedesktop.org
> > > > https://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list