[Spice-devel] [spice-common 0/7] Use glib for logging

Christophe Fergeau cfergeau at redhat.com
Fri Nov 27 07:46:59 PST 2015


Hey,

I've worked some more on switching spice_log to use glib for logging. Here is
the resulting patch series. After it, using spice-prefixed or g-prefixed log
function will all go through g_log. SPICE_ABORT_LEVEL/SPICE_DEBUG_LEVEL are still
honored even though a warning is output to mark them as deprecated.

One of the last commits introduces a spice_assert_if_fail() variant.
This could go to spice-server instead as it's only meant to be used there,
spice_return_if_fail() is non-fatal when spice-common is built by spice-gtk.
It's meant to make it more explicit that spice_return_if_fail() is returning but
aborting.

We can them do a mass s/spice_return_/spice_assert_/ in the refactoring branch
in one go with git filter-branch:

git filter-branch --tree-filter "sh ~/filter.sh || true" origin/master..

with filter.sh being:
#!/bin/sh
find . -name "*.[ch]" -type f -print0 \
| xargs -0 sed -i 's/spice_return_/spice_assert_/g'

Once the history is fixed, we can then use git rebase to introduce a commit
right before the first refactoring commit which does this global search and
replace on the current git master tree. The other commits will apply on top of
it without conflict.

In my opinion, this should allow us to move forward with the logging situation.
After this series, we can:
- use g_assert or spice_assert when we know we are not going to deal gracefully
  with a failure
- use g_return_if_fail when we know we can deal gracefully with a failure
- use spice_assert_if_fail when it's not clear and more testing/review is needed

Christophe





More information about the Spice-devel mailing list