logger BUGFIX passing error information from an extension plugin
Error messages received from extension plugins have assigned special
LY_ERR value (LY_EPLUGIN) to mark them as something outside libyang
itself. But so far this value just replaced the original LY_ERR value of
the message, so now the LY_EPLUGIN has the value 128 (0x80) to allow its
ORing with other LY_ERR values.
diff --git a/src/log.c b/src/log.c
index 22d6855..f2d79b4 100644
--- a/src/log.c
+++ b/src/log.c
@@ -297,7 +297,7 @@
return;
}
- if ((no == LY_EVALID) && (vecode == LYVE_SUCCESS)) {
+ if (((no & ~LY_EPLUGIN) == LY_EVALID) && (vecode == LYVE_SUCCESS)) {
/* assume we are inheriting the error, so inherit vecode as well */
vecode = ly_vecode(ctx);
}
@@ -483,7 +483,7 @@
}
va_start(ap, format);
- log_vprintf(ext->module->ctx, level, (level == LY_LLERR ? LY_EPLUGIN : 0), err_no, 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, plugin_msg, ap);
va_end(ap);
free(plugin_msg);