[Spice-devel] [PATCH spice-common 0/4] RFC: add structured logging and log category

marcandre.lureau at redhat.com marcandre.lureau at redhat.com
Mon Jun 12 08:19:50 UTC 2017


From: Marc-André Lureau <marcandre.lureau at redhat.com>

Hi,

This is a RFC series to clean-up Spice logging infrastructure to fully
rely on glib g_log & g_log_structured if available, and add logging
categories. It is thus a counter-proposal to Christophe D. "RFC:
Lightweight tracing mechanism", with which it shares the category
selection/listing feature.

It is useful to be able to filter the logging by domains, but GLib
only provides domain selection with G_MESSAGES_DEBUG, and it's
recommended to have few domains per application/library.  Also, domain
filtering code in glib isn't very efficient, and can't be listed
easily.

A common solution to this problem is to add some form of "sub-domain"
or "categories" on top of glib (see for ex gtkdebug.h). I propose a
simple way to register such log categories, to list and selectively
enable them with the SPICE_DEBUG= environment variable, as well as
related convenience macros.

Comments welcome,

Marc-André Lureau (4):
  log: replace spice log with glib
  Replace spice_* logging with g_*
  RFC: Add spice log categories
  Add 'common_ssl' Spice log

 common/canvas_base.c        | 148 ++++++++++-----------
 common/canvas_utils.c       |  18 +--
 common/gdi_canvas.c         |  82 ++++++------
 common/log.c                | 208 +++++++----------------------
 common/log.h                | 175 ++++++++++++++----------
 common/lz.c                 |  22 +--
 common/lz_decompress_tmpl.c |  18 +--
 common/marshaller.c         |   2 +-
 common/mem.c                |   2 +-
 common/pixman_utils.c       | 156 +++++++++++-----------
 common/quic.c               |  88 ++++++------
 common/quic_family_tmpl.c   |   6 +-
 common/quic_rgb_tmpl.c      |  32 ++---
 common/quic_tmpl.c          |  32 ++---
 common/rect.h               |   2 +-
 common/region.c             |   2 +-
 common/ring.h               |  26 ++--
 common/rop3.c               |  10 +-
 common/snd_codec.c          |  18 +--
 common/ssl_verify.c         |  74 ++++++-----
 common/sw_canvas.c          |  20 +--
 tests/test-logging.c        | 317 +-------------------------------------------
 22 files changed, 544 insertions(+), 914 deletions(-)

-- 
2.13.0.91.g00982b8dd



More information about the Spice-devel mailing list