summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2011-12-08 10:47:37 +0100
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2011-12-08 17:56:31 +0100
commitba5746c39fc451c81ea19f5eabced24670f459b9 (patch)
treebbd664f43ca643d85f7e538c331b738ea3f5de8d
parent641702b346456e47a5eb8a4adcf62ee841d1e47f (diff)
downloadlasso-ba5746c39fc451c81ea19f5eabced24670f459b9.tar.gz
lasso-ba5746c39fc451c81ea19f5eabced24670f459b9.tar.xz
lasso-ba5746c39fc451c81ea19f5eabced24670f459b9.zip
[logging] add an error() macro
-rw-r--r--lasso/logging.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/lasso/logging.h b/lasso/logging.h
index 6c659d1b..9a483c34 100644
--- a/lasso/logging.h
+++ b/lasso/logging.h
@@ -125,6 +125,23 @@ static inline void critical(const char *format, ...)
}
#endif
+#if defined(__GNUC__)
+# define error(format, args...) \
+ message(G_LOG_LEVEL_DEBUG, format, ##args)
+#elif defined(HAVE_VARIADIC_MACROS)
+# define error(...) message(G_LOG_LEVEL_DEBUG, __VA_ARGS__)
+#else
+static inline void error(const char *format, ...)
+{
+ va_list ap;
+ char s[1024];
+ va_start(ap, format);
+ g_vsnprintf(s, 1024, format, ap);
+ va_end(ap);
+ message(G_LOG_LEVEL_ERROR, "%s", s);
+}
+#endif
+
#define critical_error(rc) (critical("%s", lasso_strerror(rc)), rc)
#endif /* __LASSO_LOGGING_H_ */