validation UPDATE support for specific eapptag and message
Fixes #1705
diff --git a/src/log.c b/src/log.c
index 1737c23..a89e6ff 100644
--- a/src/log.c
+++ b/src/log.c
@@ -406,7 +406,7 @@
}
static void
-log_vprintf(const struct ly_ctx *ctx, LY_LOG_LEVEL level, LY_ERR no, LY_VECODE vecode, char *path,
+log_vprintf(const struct ly_ctx *ctx, LY_LOG_LEVEL level, LY_ERR no, LY_VECODE vecode, char *path, const char *apptag,
const char *format, va_list args)
{
char *msg = NULL;
@@ -449,7 +449,7 @@
/* assume we are inheriting the error, so inherit vecode as well */
vecode = ly_vecode(ctx);
}
- if (log_store(ctx, level, no, vecode, msg, path, NULL)) {
+ if (log_store(ctx, level, no, vecode, msg, path, apptag ? strdup(apptag) : NULL)) {
return;
}
free_strs = 0;
@@ -514,7 +514,7 @@
}
va_start(ap, format);
- log_vprintf(NULL, LY_LLDBG, 0, 0, NULL, dbg_format, ap);
+ log_vprintf(NULL, LY_LLDBG, 0, 0, NULL, NULL, dbg_format, ap);
va_end(ap);
}
@@ -526,7 +526,7 @@
va_list ap;
va_start(ap, format);
- log_vprintf(ctx, level, no, 0, NULL, format, ap);
+ log_vprintf(ctx, level, no, 0, NULL, NULL, format, ap);
va_end(ap);
}
@@ -589,7 +589,7 @@
}
void
-ly_vlog(const struct ly_ctx *ctx, LY_VECODE code, const char *format, ...)
+ly_vlog(const struct ly_ctx *ctx, const char *apptag, LY_VECODE code, const char *format, ...)
{
va_list ap;
char *path = NULL;
@@ -599,7 +599,7 @@
}
va_start(ap, format);
- log_vprintf(ctx, LY_LLERR, LY_EVALID, code, path, format, ap);
+ log_vprintf(ctx, LY_LLERR, LY_EVALID, code, path, apptag, format, ap);
/* path is spent and should not be freed! */
va_end(ap);
}
@@ -621,7 +621,8 @@
}
va_start(ap, format);
- log_vprintf(ext->module->ctx, level, (level == LY_LLERR ? LY_EPLUGIN : 0) | err_no, LYVE_OTHER, path ? strdup(path) : NULL, plugin_msg, ap);
+ log_vprintf(ext->module->ctx, level, (level == LY_LLERR ? LY_EPLUGIN : 0) | err_no, LYVE_OTHER,
+ path ? strdup(path) : NULL, NULL, plugin_msg, ap);
va_end(ap);
free(plugin_msg);
@@ -645,7 +646,7 @@
}
va_start(ap, format);
- log_vprintf(ctx, eitem->level, eitem->no, eitem->vecode, path_dup, format, ap);
+ log_vprintf(ctx, eitem->level, eitem->no, eitem->vecode, path_dup, eitem->apptag, format, ap);
va_end(ap);
}