summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-09-04 14:40:14 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-09-07 09:43:13 +0200
commit3e56dc3fc7ce31cb932fbd86e78eea02049d0b7e (patch)
tree881ac38436617b38301cd067af94eebd7cae35ea
parentb355a2a65511c32aaaddf289d70395f872bd4b26 (diff)
Improve handling of verbosity in bindings
The macro AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO is removed. The macro AFB_BINDING_PRAGMA_NO_VERBOSE_UNPREFIX is removed. The macro AFB_BINDING_PRAGMA_KEEP_VERBOSE_UNPREFIX is now used to activate the weakly named verbose macros DEBUG, INFO, NOTICE, WARNING, ERROR. The macros AFB_BINDING_PRAGMA_NO_VERBOSE_DATA and AFB_BINDING_PRAGMA_NO_VERBOSE_DETAILS can be used to tune what verbose parts are to be emitted: If AFB_BINDING_PRAGMA_NO_VERBOSE_DATA is defined then the macro will only report the file and the line that emitted the message. This mode is intended to reduce the count of static data plugin the binary. If AFB_BINDING_PRAGMA_NO_VERBOSE_DATA is not defined and AFB_BINDING_PRAGMA_NO_VERBOSE_DETAILS is defined, this is the opposite: the messages are emitted but not the file, line and function. When none of these 2 are difened, everything is emitted: the message and the details. Change-Id: Ibb83cd435797fadf90626cb06bbda77f0f8b3cde Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--include/afb/afb-binding-v1.h46
-rw-r--r--include/afb/afb-binding-v2.h66
-rw-r--r--include/afb/afb-binding.h89
-rw-r--r--src/afb-api-so-v1.c1
-rw-r--r--src/afb-api-so-v2.c1
-rw-r--r--src/afb-auth.c1
-rw-r--r--src/afb-config.c1
-rw-r--r--src/afb-ditf.c2
-rw-r--r--src/afb-monitor.c1
-rw-r--r--src/afb-trace.c1
-rw-r--r--src/afb-xreq.c12
-rw-r--r--src/main.c1
12 files changed, 124 insertions, 98 deletions
diff --git a/include/afb/afb-binding-v1.h b/include/afb/afb-binding-v1.h
index 09edddb5..6c9b5c19 100644
--- a/include/afb/afb-binding-v1.h
+++ b/include/afb/afb-binding-v1.h
@@ -147,30 +147,51 @@ struct afb_binding_interface_v1
/*
* Macros for logging messages
*/
-#if !defined(AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO)
-# if !defined(AFB_BINDING_PRAGMA_NO_VERBOSE_DETAILS)
-# define _AFB_LOGGING_V1_(itf,vlevel,llevel,...) \
+#if defined(AFB_BINDING_PRAGMA_NO_VERBOSE_DATA)
+
+# define _AFB_LOGGING_V1_(itf,vlevel,llevel,...) \
do{ \
- if(itf->verbosity>=vlevel) \
- afb_daemon_verbose2_v1(itf->daemon,llevel,__FILE__,__LINE__,__func__,__VA_ARGS__); \
+ if(itf->verbosity>=vlevel) {\
+ if (llevel <= AFB_VERBOSITY_LEVEL_ERROR) \
+ afb_daemon_verbose2_v1(itf->daemon,llevel,__FILE__,__LINE__,__func__,__VA_ARGS__); \
+ else \
+ afb_daemon_verbose2_v1(itf->daemon,llevel,__FILE__,__LINE__,NULL,NULL); \
+ } \
}while(0)
-# define _AFB_REQ_LOGGING_V1_(itf,vlevel,llevel,req,...) \
+# define _AFB_REQ_LOGGING_V1_(itf,vlevel,llevel,req,...) \
do{ \
if(itf->verbosity>=vlevel) \
- afb_req_verbose(req,llevel,__FILE__,__LINE__,__func__,__VA_ARGS__); \
+ afb_req_verbose(req,llevel,__FILE__,__LINE__,NULL,NULL); \
}while(0)
-# else
-# define _AFB_LOGGING_V1_(itf,vlevel,llevel,...) \
+
+#elif defined(AFB_BINDING_PRAGMA_NO_VERBOSE_DETAILS)
+
+# define _AFB_LOGGING_V1_(itf,vlevel,llevel,...) \
do{ \
if(itf->verbosity>=vlevel) \
- afb_daemon_verbose_v1(itf->daemon,llevel,NULL,0,NULL,__VA_ARGS__); \
+ afb_daemon_verbose2_v1(itf->daemon,llevel,NULL,0,NULL,__VA_ARGS__); \
}while(0)
-# define _AFB_REQ_LOGGING_V1_(itf,vlevel,llevel,req,...) \
+# define _AFB_REQ_LOGGING_V1_(itf,vlevel,llevel,req,...) \
do{ \
if(itf->verbosity>=vlevel) \
afb_req_verbose(req,llevel,NULL,0,NULL,__VA_ARGS__); \
}while(0)
-# endif
+
+#else
+
+# define _AFB_LOGGING_V1_(itf,vlevel,llevel,...) \
+ do{ \
+ if(itf->verbosity>=vlevel) \
+ afb_daemon_verbose2_v1(itf->daemon,llevel,__FILE__,__LINE__,__func__,__VA_ARGS__); \
+ }while(0)
+# define _AFB_REQ_LOGGING_V1_(itf,vlevel,llevel,req,...) \
+ do{ \
+ if(itf->verbosity>=vlevel) \
+ afb_req_verbose(req,llevel,__FILE__,__LINE__,__func__,__VA_ARGS__); \
+ }while(0)
+
+#endif
+
# include "afb-verbosity.h"
# define AFB_ERROR_V1(itf,...) _AFB_LOGGING_V1_(itf,AFB_VERBOSITY_LEVEL_ERROR,_AFB_SYSLOG_LEVEL_ERROR_,__VA_ARGS__)
# define AFB_WARNING_V1(itf,...) _AFB_LOGGING_V1_(itf,AFB_VERBOSITY_LEVEL_WARNING,_AFB_SYSLOG_LEVEL_WARNING_,__VA_ARGS__)
@@ -182,5 +203,4 @@ struct afb_binding_interface_v1
# define AFB_REQ_NOTICE_V1(itf,...) _AFB_REQ_LOGGING_V1_(itf,AFB_VERBOSITY_LEVEL_NOTICE,_AFB_SYSLOG_LEVEL_NOTICE_,__VA_ARGS__)
# define AFB_REQ_INFO_V1(itf,...) _AFB_REQ_LOGGING_V1_(itf,AFB_VERBOSITY_LEVEL_INFO,_AFB_SYSLOG_LEVEL_INFO_,__VA_ARGS__)
# define AFB_REQ_DEBUG_V1(itf,...) _AFB_REQ_LOGGING_V1_(itf,AFB_VERBOSITY_LEVEL_DEBUG,_AFB_SYSLOG_LEVEL_DEBUG_,__VA_ARGS__)
-#endif
diff --git a/include/afb/afb-binding-v2.h b/include/afb/afb-binding-v2.h
index 8831a434..4780b4ef 100644
--- a/include/afb/afb-binding-v2.h
+++ b/include/afb/afb-binding-v2.h
@@ -92,43 +92,63 @@ struct afb_binding_data_v2 AFB_BINDING_DATA_NAME_V2 __attribute__ ((weak));
/*
* Macros for logging messages
*/
-#if !defined(AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO)
-# if !defined(AFB_BINDING_PRAGMA_NO_VERBOSE_DETAILS)
-# define _AFB_LOGGING_V2_(vlevel,llevel,...) \
+#if defined(AFB_BINDING_PRAGMA_NO_VERBOSE_DATA)
+
+# define _AFB_LOGGING_V2_(vlevel,llevel,...) \
do{ \
- if(AFB_BINDING_DATA_NAME_V2.verbosity>=vlevel) \
- afb_daemon_verbose_v2(llevel,__FILE__,__LINE__,__func__,__VA_ARGS__); \
+ if(AFB_BINDING_DATA_NAME_V2.verbosity>=vlevel) {\
+ if (llevel <= AFB_VERBOSITY_LEVEL_ERROR) \
+ afb_daemon_verbose_v2(llevel,__FILE__,__LINE__,__func__,__VA_ARGS__); \
+ else \
+ afb_daemon_verbose_v2(llevel,__FILE__,__LINE__,NULL,NULL); \
+ } \
}while(0)
-# define _AFB_REQ_LOGGING_V2_(vlevel,llevel,req,...) \
+# define _AFB_REQ_LOGGING_V2_(vlevel,llevel,req,...) \
do{ \
if(AFB_BINDING_DATA_NAME_V2.verbosity>=vlevel) \
- afb_req_verbose(req,llevel,__FILE__,__LINE__,__func__,__VA_ARGS__); \
+ afb_req_verbose(req,llevel,__FILE__,__LINE__,NULL,NULL); \
}while(0)
-# else
-# define _AFB_LOGGING_V2_(vlevel,llevel,...) \
+
+#elif defined(AFB_BINDING_PRAGMA_NO_VERBOSE_DETAILS)
+
+# define _AFB_LOGGING_V2_(vlevel,llevel,...) \
do{ \
- if(afbBindingV2data.verbosity>=vlevel) \
+ if(AFB_BINDING_DATA_NAME_V2.verbosity>=vlevel) \
afb_daemon_verbose_v2(llevel,NULL,0,NULL,__VA_ARGS__); \
}while(0)
-# define _AFB_REQ_LOGGING_V2_(vlevel,llevel,req,...) \
+# define _AFB_REQ_LOGGING_V2_(vlevel,llevel,req,...) \
do{ \
if(AFB_BINDING_DATA_NAME_V2.verbosity>=vlevel) \
afb_req_verbose(req,llevel,NULL,0,NULL,__VA_ARGS__); \
}while(0)
-# endif
-# include "afb-verbosity.h"
-# define AFB_ERROR_V2(...) _AFB_LOGGING_V2_(AFB_VERBOSITY_LEVEL_ERROR,_AFB_SYSLOG_LEVEL_ERROR_,__VA_ARGS__)
-# define AFB_WARNING_V2(...) _AFB_LOGGING_V2_(AFB_VERBOSITY_LEVEL_WARNING,_AFB_SYSLOG_LEVEL_WARNING_,__VA_ARGS__)
-# define AFB_NOTICE_V2(...) _AFB_LOGGING_V2_(AFB_VERBOSITY_LEVEL_NOTICE,_AFB_SYSLOG_LEVEL_NOTICE_,__VA_ARGS__)
-# define AFB_INFO_V2(...) _AFB_LOGGING_V2_(AFB_VERBOSITY_LEVEL_INFO,_AFB_SYSLOG_LEVEL_INFO_,__VA_ARGS__)
-# define AFB_DEBUG_V2(...) _AFB_LOGGING_V2_(AFB_VERBOSITY_LEVEL_DEBUG,_AFB_SYSLOG_LEVEL_DEBUG_,__VA_ARGS__)
-# define AFB_REQ_ERROR_V2(...) _AFB_REQ_LOGGING_V2_(AFB_VERBOSITY_LEVEL_ERROR,_AFB_SYSLOG_LEVEL_ERROR_,__VA_ARGS__)
-# define AFB_REQ_WARNING_V2(...) _AFB_REQ_LOGGING_V2_(AFB_VERBOSITY_LEVEL_WARNING,_AFB_SYSLOG_LEVEL_WARNING_,__VA_ARGS__)
-# define AFB_REQ_NOTICE_V2(...) _AFB_REQ_LOGGING_V2_(AFB_VERBOSITY_LEVEL_NOTICE,_AFB_SYSLOG_LEVEL_NOTICE_,__VA_ARGS__)
-# define AFB_REQ_INFO_V2(...) _AFB_REQ_LOGGING_V2_(AFB_VERBOSITY_LEVEL_INFO,_AFB_SYSLOG_LEVEL_INFO_,__VA_ARGS__)
-# define AFB_REQ_DEBUG_V2(...) _AFB_REQ_LOGGING_V2_(AFB_VERBOSITY_LEVEL_DEBUG,_AFB_SYSLOG_LEVEL_DEBUG_,__VA_ARGS__)
+
+#else
+
+# define _AFB_LOGGING_V2_(vlevel,llevel,...) \
+ do{ \
+ if(AFB_BINDING_DATA_NAME_V2.verbosity>=vlevel) \
+ afb_daemon_verbose_v2(llevel,__FILE__,__LINE__,__func__,__VA_ARGS__); \
+ }while(0)
+# define _AFB_REQ_LOGGING_V2_(vlevel,llevel,req,...) \
+ do{ \
+ if(AFB_BINDING_DATA_NAME_V2.verbosity>=vlevel) \
+ afb_req_verbose(req,llevel,__FILE__,__LINE__,__func__,__VA_ARGS__); \
+ }while(0)
+
#endif
+#include "afb-verbosity.h"
+#define AFB_ERROR_V2(...) _AFB_LOGGING_V2_(AFB_VERBOSITY_LEVEL_ERROR,_AFB_SYSLOG_LEVEL_ERROR_,__VA_ARGS__)
+#define AFB_WARNING_V2(...) _AFB_LOGGING_V2_(AFB_VERBOSITY_LEVEL_WARNING,_AFB_SYSLOG_LEVEL_WARNING_,__VA_ARGS__)
+#define AFB_NOTICE_V2(...) _AFB_LOGGING_V2_(AFB_VERBOSITY_LEVEL_NOTICE,_AFB_SYSLOG_LEVEL_NOTICE_,__VA_ARGS__)
+#define AFB_INFO_V2(...) _AFB_LOGGING_V2_(AFB_VERBOSITY_LEVEL_INFO,_AFB_SYSLOG_LEVEL_INFO_,__VA_ARGS__)
+#define AFB_DEBUG_V2(...) _AFB_LOGGING_V2_(AFB_VERBOSITY_LEVEL_DEBUG,_AFB_SYSLOG_LEVEL_DEBUG_,__VA_ARGS__)
+#define AFB_REQ_ERROR_V2(...) _AFB_REQ_LOGGING_V2_(AFB_VERBOSITY_LEVEL_ERROR,_AFB_SYSLOG_LEVEL_ERROR_,__VA_ARGS__)
+#define AFB_REQ_WARNING_V2(...) _AFB_REQ_LOGGING_V2_(AFB_VERBOSITY_LEVEL_WARNING,_AFB_SYSLOG_LEVEL_WARNING_,__VA_ARGS__)
+#define AFB_REQ_NOTICE_V2(...) _AFB_REQ_LOGGING_V2_(AFB_VERBOSITY_LEVEL_NOTICE,_AFB_SYSLOG_LEVEL_NOTICE_,__VA_ARGS__)
+#define AFB_REQ_INFO_V2(...) _AFB_REQ_LOGGING_V2_(AFB_VERBOSITY_LEVEL_INFO,_AFB_SYSLOG_LEVEL_INFO_,__VA_ARGS__)
+#define AFB_REQ_DEBUG_V2(...) _AFB_REQ_LOGGING_V2_(AFB_VERBOSITY_LEVEL_DEBUG,_AFB_SYSLOG_LEVEL_DEBUG_,__VA_ARGS__)
+
#include "afb-daemon-v2.h"
#include "afb-service-v2.h"
diff --git a/include/afb/afb-binding.h b/include/afb/afb-binding.h
index 45cff649..1c4ec3f2 100644
--- a/include/afb/afb-binding.h
+++ b/include/afb/afb-binding.h
@@ -139,21 +139,17 @@ typedef struct afb_service_itf afb_service_itf;
# define AFB_SESSION_LOA_GE_2 AFB_SESSION_LOA_GE_2_V1
# define AFB_SESSION_LOA_GE_3 AFB_SESSION_LOA_GE_3_V1
-# if !defined(AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO)
-
-# define AFB_ERROR AFB_ERROR_V1
-# define AFB_WARNING AFB_WARNING_V1
-# define AFB_NOTICE AFB_NOTICE_V1
-# define AFB_INFO AFB_INFO_V1
-# define AFB_DEBUG AFB_DEBUG_V1
-
-# define AFB_REQ_ERROR AFB_REQ_ERROR_V1
-# define AFB_REQ_WARNING AFB_REQ_WARNING_V1
-# define AFB_REQ_NOTICE AFB_REQ_NOTICE_V1
-# define AFB_REQ_INFO AFB_REQ_INFO_V1
-# define AFB_REQ_DEBUG AFB_REQ_DEBUG_V1
-
-# endif
+# define AFB_ERROR AFB_ERROR_V1
+# define AFB_WARNING AFB_WARNING_V1
+# define AFB_NOTICE AFB_NOTICE_V1
+# define AFB_INFO AFB_INFO_V1
+# define AFB_DEBUG AFB_DEBUG_V1
+
+# define AFB_REQ_ERROR AFB_REQ_ERROR_V1
+# define AFB_REQ_WARNING AFB_REQ_WARNING_V1
+# define AFB_REQ_NOTICE AFB_REQ_NOTICE_V1
+# define AFB_REQ_INFO AFB_REQ_INFO_V1
+# define AFB_REQ_DEBUG AFB_REQ_DEBUG_V1
#define afb_daemon_get_event_loop afb_daemon_get_event_loop_v1
#define afb_daemon_get_user_bus afb_daemon_get_user_bus_v1
@@ -197,21 +193,17 @@ typedef struct afb_service_itf afb_service_itf;
# define AFB_SESSION_LOA_2 AFB_SESSION_LOA_2_V2
# define AFB_SESSION_LOA_3 AFB_SESSION_LOA_3_V2
-# if !defined(AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO)
-
-# define AFB_ERROR AFB_ERROR_V2
-# define AFB_WARNING AFB_WARNING_V2
-# define AFB_NOTICE AFB_NOTICE_V2
-# define AFB_INFO AFB_INFO_V2
-# define AFB_DEBUG AFB_DEBUG_V2
+# define AFB_ERROR AFB_ERROR_V2
+# define AFB_WARNING AFB_WARNING_V2
+# define AFB_NOTICE AFB_NOTICE_V2
+# define AFB_INFO AFB_INFO_V2
+# define AFB_DEBUG AFB_DEBUG_V2
-# define AFB_REQ_ERROR AFB_REQ_ERROR_V2
-# define AFB_REQ_WARNING AFB_REQ_WARNING_V2
-# define AFB_REQ_NOTICE AFB_REQ_NOTICE_V2
-# define AFB_REQ_INFO AFB_REQ_INFO_V2
-# define AFB_REQ_DEBUG AFB_REQ_DEBUG_V2
-
-# endif
+# define AFB_REQ_ERROR AFB_REQ_ERROR_V2
+# define AFB_REQ_WARNING AFB_REQ_WARNING_V2
+# define AFB_REQ_NOTICE AFB_REQ_NOTICE_V2
+# define AFB_REQ_INFO AFB_REQ_INFO_V2
+# define AFB_REQ_DEBUG AFB_REQ_DEBUG_V2
#define afb_daemon_get_event_loop afb_daemon_get_event_loop_v2
#define afb_daemon_get_user_bus afb_daemon_get_user_bus_v2
@@ -237,32 +229,27 @@ typedef struct afb_service_itf afb_service_itf;
#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)
+# define afb_verbose_error() (afb_get_verbosity() >= AFB_VERBOSITY_LEVEL_ERROR)
+# define afb_verbose_warning() (afb_get_verbosity() >= AFB_VERBOSITY_LEVEL_WARNING)
+# define afb_verbose_notice() (afb_get_verbosity() >= AFB_VERBOSITY_LEVEL_NOTICE)
+# define afb_verbose_info() (afb_get_verbosity() >= AFB_VERBOSITY_LEVEL_INFO)
+# define afb_verbose_debug() (afb_get_verbosity() >= AFB_VERBOSITY_LEVEL_DEBUG)
-# if !defined(AFB_BINDING_PRAGMA_KEEP_VERBOSE_UNPREFIX) && !defined(AFB_BINDING_PRAGMA_NO_VERBOSE_UNPREFIX)
-# define AFB_BINDING_PRAGMA_NO_VERBOSE_UNPREFIX
-# endif
#endif
/***************************************************************************************************/
-#if !defined(AFB_BINDING_PRAGMA_NO_VERBOSE_UNPREFIX)
-# if !defined(AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO)
-# define ERROR AFB_ERROR
-# define WARNING AFB_WARNING
-# define NOTICE AFB_NOTICE
-# define INFO AFB_INFO
-# define DEBUG AFB_DEBUG
-
-# define REQ_ERROR AFB_REQ_ERROR
-# define REQ_WARNING AFB_REQ_WARNING
-# define REQ_NOTICE AFB_REQ_NOTICE
-# define REQ_INFO AFB_REQ_INFO
-# define REQ_DEBUG AFB_REQ_DEBUG
-# endif
+#if defined(AFB_BINDING_PRAGMA_KEEP_VERBOSE_UNPREFIX)
+# define ERROR AFB_ERROR
+# define WARNING AFB_WARNING
+# define NOTICE AFB_NOTICE
+# define INFO AFB_INFO
+# define DEBUG AFB_DEBUG
+
+# define REQ_ERROR AFB_REQ_ERROR
+# define REQ_WARNING AFB_REQ_WARNING
+# define REQ_NOTICE AFB_REQ_NOTICE
+# define REQ_INFO AFB_REQ_INFO
+# define REQ_DEBUG AFB_REQ_DEBUG
#endif
diff --git a/src/afb-api-so-v1.c b/src/afb-api-so-v1.c
index a341dac3..ad7a0cdd 100644
--- a/src/afb-api-so-v1.c
+++ b/src/afb-api-so-v1.c
@@ -16,7 +16,6 @@
*/
#define _GNU_SOURCE
-#define AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO
#include <stdio.h>
#include <string.h>
diff --git a/src/afb-api-so-v2.c b/src/afb-api-so-v2.c
index 49fac6b6..d8941a42 100644
--- a/src/afb-api-so-v2.c
+++ b/src/afb-api-so-v2.c
@@ -16,7 +16,6 @@
*/
#define _GNU_SOURCE
-#define AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO
#include <stdlib.h>
#include <string.h>
diff --git a/src/afb-auth.c b/src/afb-auth.c
index 9d54a03b..2f5daf0c 100644
--- a/src/afb-auth.c
+++ b/src/afb-auth.c
@@ -17,7 +17,6 @@
*/
#define _GNU_SOURCE
-#define AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO
#include <stdlib.h>
diff --git a/src/afb-config.c b/src/afb-config.c
index 0bfd9d4c..7635575b 100644
--- a/src/afb-config.c
+++ b/src/afb-config.c
@@ -16,7 +16,6 @@
*/
#define _GNU_SOURCE
-#define AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO
#include <stdlib.h>
#include <stdio.h>
diff --git a/src/afb-ditf.c b/src/afb-ditf.c
index 28cd46a7..bc020ba3 100644
--- a/src/afb-ditf.c
+++ b/src/afb-ditf.c
@@ -46,7 +46,7 @@ static void vverbose_cb(void *closure, int level, const char *file, int line, co
char *p;
struct afb_ditf *ditf = closure;
- if (vasprintf(&p, fmt, args) < 0)
+ if (!fmt || vasprintf(&p, fmt, args) < 0)
vverbose(level, file, line, function, fmt, args);
else {
verbose(level, file, line, function, "[API %s] %s", ditf->api, p);
diff --git a/src/afb-monitor.c b/src/afb-monitor.c
index 44233109..937e2160 100644
--- a/src/afb-monitor.c
+++ b/src/afb-monitor.c
@@ -16,7 +16,6 @@
*/
#define _GNU_SOURCE
-#define AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO
#include <string.h>
diff --git a/src/afb-trace.c b/src/afb-trace.c
index f97d9252..b63756d3 100644
--- a/src/afb-trace.c
+++ b/src/afb-trace.c
@@ -16,7 +16,6 @@
*/
#define _GNU_SOURCE
-#define AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO
#include <assert.h>
#include <string.h>
diff --git a/src/afb-xreq.c b/src/afb-xreq.c
index 3535ce5c..fe999afa 100644
--- a/src/afb-xreq.c
+++ b/src/afb-xreq.c
@@ -16,7 +16,6 @@
*/
#define _GNU_SOURCE
-#define AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO
#include <stdlib.h>
#include <stdio.h>
@@ -438,8 +437,15 @@ static int xreq_subcallsync_cb(void *closure, const char *api, const char *verb,
static void xreq_vverbose_cb(void*closure, int level, const char *file, int line, const char *func, const char *fmt, va_list args)
{
- /* TODO: improves the implementation. example: on condition make a list of log messages that will be returned */
- vverbose(level, file, line, func, fmt, args);
+ char *p;
+ struct afb_xreq *xreq = closure;
+
+ if (!fmt || vasprintf(&p, fmt, args) < 0)
+ vverbose(level, file, line, func, fmt, args);
+ else {
+ verbose(level, file, line, func, "[REQ/API %s] %s", xreq->api, p);
+ free(p);
+ }
}
static struct afb_stored_req *xreq_store_cb(void *closure)
diff --git a/src/main.c b/src/main.c
index bffcb388..6ec392a2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -17,7 +17,6 @@
*/
#define _GNU_SOURCE
-#define AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO
#include <stdlib.h>
#include <stdio.h>