From 2acac069495b7596da2b9bf10146dca0fc4f799f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 7 Aug 2012 15:40:39 +0100 Subject: [PATCH 5/9] Add DEBUG(), etc., macros based on the ones in telepathy-glib DEBUG ("%s", x) is more or less equivalent to g_debug ("%s: %s", __FUNCTION__, x). Similar for CRITICAL() and g_critical(), etc. --- ytstenut/ytstenut-internal.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/ytstenut/ytstenut-internal.h b/ytstenut/ytstenut-internal.h index d7f518d..d231521 100644 --- a/ytstenut/ytstenut-internal.h +++ b/ytstenut/ytstenut-internal.h @@ -44,5 +44,29 @@ ytstenut_init (void); YtsDebugFlags ytstenut_get_debug_flags (void); +#define ERROR(format, ...) \ + do \ + { \ + g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, "%s: " format, \ + G_STRFUNC, ##__VA_ARGS__); \ + g_assert_not_reached (); \ + } \ + while (0) +#define CRITICAL(format, ...) \ + g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "%s: " format, \ + G_STRFUNC, ##__VA_ARGS__) +#define WARNING(format, ...) \ + g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "%s: " format, \ + G_STRFUNC, ##__VA_ARGS__) +#define MESSAGE(format, ...) \ + g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, "%s: " format, \ + G_STRFUNC, ##__VA_ARGS__) +#define INFO(format, ...) \ + g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "%s: " format, \ + G_STRFUNC, ##__VA_ARGS__) +#define DEBUG(format, ...) \ + g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: " format, \ + G_STRFUNC, ##__VA_ARGS__) + #endif /* YTSTENUT_INTERNAL_H */ -- 1.7.10.4