summaryrefslogtreecommitdiffstats
path: root/include/afb/afb-binding.h
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-06-28 14:44:11 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-06-28 19:13:29 +0200
commitb96bdf20d6c4b6a769ebfcff86efbaf904dd115f (patch)
treeffaf2139c06f286ab64fa9484d84898188299569 /include/afb/afb-binding.h
parent09f86852f8b406ed8203c1730f4dc65590ed0030 (diff)
Add new macro for handling verbosity
It might be interesting to test the verbosity level before making resource consuming stuff. Se example below: if (afb_verbose_notice()) { char *s = compute(); NOTICE("I got %s", s); free(s); } Change-Id: I7be4248a86fc2a2a23820ec822b36d9fccafb203 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'include/afb/afb-binding.h')
-rw-r--r--include/afb/afb-binding.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/afb/afb-binding.h b/include/afb/afb-binding.h
index 3215c594..69be174a 100644
--- a/include/afb/afb-binding.h
+++ b/include/afb/afb-binding.h
@@ -179,6 +179,10 @@ typedef struct afb_service_itf afb_service_itf;
#if AFB_BINDING_VERSION == 2
# define afb_binding afb_binding_v2
+# define afb_get_verbosity afb_get_verbosity_v2
+# define afb_get_daemon afb_get_daemon_v2
+# define afb_get_service afb_get_service_v2
+
# define AFB_SESSION_NONE AFB_SESSION_NONE_V2
# define AFB_SESSION_CLOSE AFB_SESSION_CLOSE_V2
@@ -229,6 +233,20 @@ typedef struct afb_service_itf afb_service_itf;
#endif
+/***************************************************************************************************/
+
+#if AFB_BINDING_VERSION >= 2
+
+# define afb_verbose_error() (afb_get_verbosity() >= 0)
+# define afb_verbose_warning() (afb_get_verbosity() >= 1)
+# define afb_verbose_notice() (afb_get_verbosity() >= 1)
+# define afb_verbose_info() (afb_get_verbosity() >= 2)
+# define afb_verbose_debug() (afb_get_verbosity() >= 3)
+
+#endif
+
+/***************************************************************************************************/
+
#if !defined(AFB_BINDING_PRAGMA_NO_VERBOSE_UNPREFIX)
# if !defined(AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO)
# define ERROR AFB_ERROR