aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-hook.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-05-31 11:32:46 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-05-31 11:32:46 +0200
commit524ce4c40da3b25630dffdd80c5aca99364a3569 (patch)
tree9d6e256f9b818c73d99d56c69da0149b052f2a83 /src/afb-hook.c
parent06c7e1c7e9aec77a1a22ccb14dd0e540cf08f5d9 (diff)
Add logging by request
Change-Id: I6dda714bcb8c36392c14a1981cfb8960f3db45b8 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-hook.c')
-rw-r--r--src/afb-hook.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/afb-hook.c b/src/afb-hook.c
index cade990c..6afcd2fb 100644
--- a/src/afb-hook.c
+++ b/src/afb-hook.c
@@ -210,6 +210,24 @@ static void hook_xreq_subcallsync_result_default_cb(void * closure, const struct
_hook_xreq_(xreq, " ...subcallsync... -> %d: %s", status, json_object_to_json_string(result));
}
+static void hook_xreq_vverbose_default_cb(void * closure, const struct afb_xreq *xreq, int level, const char *file, int line, const char *func, const char *fmt, va_list args)
+{
+ int len;
+ char *msg;
+ va_list ap;
+
+ va_copy(ap, args);
+ len = vasprintf(&msg, fmt, ap);
+ va_end(ap);
+
+ if (len < 0)
+ _hook_xreq_(xreq, "vverbose(%d, %s, %d, %s) -> %s ? ? ?", level, file, line, func, fmt);
+ else {
+ _hook_xreq_(xreq, "vverbose(%d, %s, %d, %s) -> %s", level, file, line, func, msg);
+ free(msg);
+ }
+}
+
static struct afb_hook_xreq_itf hook_xreq_default_itf = {
.hook_xreq_begin = hook_xreq_begin_default_cb,
.hook_xreq_end = hook_xreq_end_default_cb,
@@ -229,6 +247,7 @@ static struct afb_hook_xreq_itf hook_xreq_default_itf = {
.hook_xreq_subcall_result = hook_xreq_subcall_result_default_cb,
.hook_xreq_subcallsync = hook_xreq_subcallsync_default_cb,
.hook_xreq_subcallsync_result = hook_xreq_subcallsync_result_default_cb,
+ .hook_xreq_vverbose = hook_xreq_vverbose_default_cb
};
/******************************************************************************
@@ -349,6 +368,11 @@ int afb_hook_xreq_subcallsync_result(const struct afb_xreq *xreq, int status, st
return status;
}
+void afb_hook_xreq_vverbose(const struct afb_xreq *xreq, int level, const char *file, int line, const char *func, const char *fmt, va_list args)
+{
+ _HOOK_XREQ_(vverbose, xreq, level, file ?: "?", line, func ?: "?", fmt, args);
+}
+
/******************************************************************************
* section: hooking xreqs
*****************************************************************************/