[Spice-devel] [spice-common 2/2] log: spice_printerr goes through g_message

Christophe Fergeau cfergeau at redhat.com
Wed Jun 20 14:37:52 UTC 2018


On Wed, Jun 20, 2018 at 10:16:56AM -0400, Frediano Ziglio wrote:
> > 
> > ---
> >  common/log.h | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/common/log.h b/common/log.h
> > index e0fd34b..4058208 100644
> > --- a/common/log.h
> > +++ b/common/log.h
> > @@ -57,9 +57,7 @@ void spice_log(GLogLevelFlags log_level,
> >      spice_log(G_LOG_LEVEL_WARNING, SPICE_STRLOC, __FUNCTION__, "should not
> >      be reached"); \
> >  } G_STMT_END
> >  
> > -#define spice_printerr(format, ...) G_STMT_START {                      \
> > -    fprintf(stderr, "%s: " format "\n", __FUNCTION__, ## __VA_ARGS__);  \
> > -} G_STMT_END
> > +#define spice_printerr g_message
> >  
> >  #define spice_info(format, ...) G_STMT_START {                         \
> >      spice_log(G_LOG_LEVEL_INFO, SPICE_STRLOC, __FUNCTION__, "" format, ##
> >      __VA_ARGS__); \
> 
> I would instead remove all usages of this macro and remove it.
> Why printing to standard error from a library?
> Looking at occurrences some are errors reports some are just debugging
> so using the same level (g_message) seems wrong.

oops, this one was not meant to be sent, it's just some wip/quick hack
for testing in my tree, my plan is indeed to replace the calls with
g_debug/g_message/g_warning.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180620/02d62754/attachment.sig>


More information about the Spice-devel mailing list