As we decided to not use GLib domains do not allow the usage of this obsolete macro to use different logging domains. Will be replaced by some different categorization. Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> --- common/log.c | 7 ++++--- common/log.h | 25 ++++++++++++------------- tests/test-logging.c | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/common/log.c b/common/log.c index 92f5bc0..a440ddf 100644 --- a/common/log.c +++ b/common/log.c @@ -41,6 +41,8 @@ static int abort_mask = 0; #endif #endif +#define SPICE_LOG_DOMAIN "Spice" + typedef enum { SPICE_LOG_LEVEL_ERROR, SPICE_LOG_LEVEL_CRITICAL, @@ -182,8 +184,7 @@ static void spice_logv(const char *log_domain, } } -void spice_log(const char *log_domain, - GLogLevelFlags log_level, +void spice_log(GLogLevelFlags log_level, const char *strloc, const char *function, const char *format, @@ -192,6 +193,6 @@ void spice_log(const char *log_domain, va_list args; va_start (args, format); - spice_logv (log_domain, log_level, strloc, function, format, args); + spice_logv (SPICE_LOG_DOMAIN, log_level, strloc, function, format, args); va_end (args); } diff --git a/common/log.h b/common/log.h index 1ea2313..ed701ca 100644 --- a/common/log.h +++ b/common/log.h @@ -27,35 +27,34 @@ SPICE_BEGIN_DECLS -#ifndef SPICE_LOG_DOMAIN -#define SPICE_LOG_DOMAIN "Spice" +#ifdef SPICE_LOG_DOMAIN +#error Do not use obsolete SPICE_LOG_DOMAIN macro, is currently unused #endif #define SPICE_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) -void spice_log(const char *log_domain, - GLogLevelFlags log_level, +void spice_log(GLogLevelFlags log_level, const char *strloc, const char *function, const char *format, - ...) SPICE_ATTR_PRINTF(5, 6); + ...) SPICE_ATTR_PRINTF(4, 5); #define spice_return_if_fail(x) G_STMT_START { \ if G_LIKELY(x) { } else { \ - spice_log(SPICE_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, SPICE_STRLOC, G_STRFUNC, "condition `%s' failed", #x); \ + spice_log(G_LOG_LEVEL_CRITICAL, SPICE_STRLOC, G_STRFUNC, "condition `%s' failed", #x); \ return; \ } \ } G_STMT_END #define spice_return_val_if_fail(x, val) G_STMT_START { \ if G_LIKELY(x) { } else { \ - spice_log(SPICE_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, SPICE_STRLOC, __FUNCTION__, "condition `%s' failed", #x); \ + spice_log(G_LOG_LEVEL_CRITICAL, SPICE_STRLOC, __FUNCTION__, "condition `%s' failed", #x); \ return (val); \ } \ } G_STMT_END #define spice_warn_if_reached() G_STMT_START { \ - spice_log(SPICE_LOG_DOMAIN, G_LOG_LEVEL_WARNING, SPICE_STRLOC, __FUNCTION__, "should not be reached"); \ + spice_log(G_LOG_LEVEL_WARNING, SPICE_STRLOC, __FUNCTION__, "should not be reached"); \ } G_STMT_END #define spice_printerr(format, ...) G_STMT_START { \ @@ -63,23 +62,23 @@ void spice_log(const char *log_domain, } G_STMT_END #define spice_info(format, ...) G_STMT_START { \ - spice_log(SPICE_LOG_DOMAIN, G_LOG_LEVEL_INFO, SPICE_STRLOC, __FUNCTION__, format, ## __VA_ARGS__); \ + spice_log(G_LOG_LEVEL_INFO, SPICE_STRLOC, __FUNCTION__, format, ## __VA_ARGS__); \ } G_STMT_END #define spice_debug(format, ...) G_STMT_START { \ - spice_log(SPICE_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, SPICE_STRLOC, __FUNCTION__, format, ## __VA_ARGS__); \ + spice_log(G_LOG_LEVEL_DEBUG, SPICE_STRLOC, __FUNCTION__, format, ## __VA_ARGS__); \ } G_STMT_END #define spice_warning(format, ...) G_STMT_START { \ - spice_log(SPICE_LOG_DOMAIN, G_LOG_LEVEL_WARNING, SPICE_STRLOC, __FUNCTION__, format, ## __VA_ARGS__); \ + spice_log(G_LOG_LEVEL_WARNING, SPICE_STRLOC, __FUNCTION__, format, ## __VA_ARGS__); \ } G_STMT_END #define spice_critical(format, ...) G_STMT_START { \ - spice_log(SPICE_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, SPICE_STRLOC, __FUNCTION__, format, ## __VA_ARGS__); \ + spice_log(G_LOG_LEVEL_CRITICAL, SPICE_STRLOC, __FUNCTION__, format, ## __VA_ARGS__); \ } G_STMT_END #define spice_error(format, ...) G_STMT_START { \ - spice_log(SPICE_LOG_DOMAIN, G_LOG_LEVEL_ERROR, SPICE_STRLOC, __FUNCTION__, format, ## __VA_ARGS__); \ + spice_log(G_LOG_LEVEL_ERROR, SPICE_STRLOC, __FUNCTION__, format, ## __VA_ARGS__); \ } G_STMT_END #define spice_warn_if_fail(x) G_STMT_START { \ diff --git a/tests/test-logging.c b/tests/test-logging.c index f1ad1b6..af3a01b 100644 --- a/tests/test-logging.c +++ b/tests/test-logging.c @@ -19,13 +19,13 @@ #endif #define G_LOG_DOMAIN "Spice" -#define SPICE_LOG_DOMAIN G_LOG_DOMAIN #include <glib.h> #include <stdlib.h> #include "common/log.h" +#define SPICE_LOG_DOMAIN G_LOG_DOMAIN #define OTHER_LOG_DOMAIN "Other" #define LOG_OTHER_HELPER(suffix, level) \ static void G_PASTE(other_, suffix)(const gchar *format, ...) \ -- 2.9.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel