log BUGFIX lysc log path was not working
diff --git a/src/common.h b/src/common.h
index 9392b5c..1f0cbe7 100644
--- a/src/common.h
+++ b/src/common.h
@@ -82,11 +82,11 @@
enum LY_VLOG_ELEM {
LY_VLOG_NONE = 0,
- LY_VLOG_LINE,/* line number (uint64_t*) */
- LY_VLOG_LYS, /* struct lysc_node* */
- LY_VLOG_LYD, /* struct lyd_node* */
- LY_VLOG_STR, /* const char* */
- LY_VLOG_PREV /* use exact same previous path */
+ LY_VLOG_LINE, /* line number (uint64_t*) */
+ LY_VLOG_LYSC, /* struct lysc_node* */
+ LY_VLOG_LYD, /* struct lyd_node* */
+ LY_VLOG_STR, /* const char* */
+ LY_VLOG_PREV /* use exact same previous path */
};
extern THREAD_LOCAL enum int_log_opts log_opt;
diff --git a/src/log.c b/src/log.c
index 430283e..e04f6c3 100644
--- a/src/log.c
+++ b/src/log.c
@@ -412,13 +412,17 @@
switch (elem_type) {
case LY_VLOG_STR:
- (*path) = strdup(elem);
+ *path = strdup(elem);
LY_CHECK_ERR_RET(!(*path), LOGMEM(ctx), LY_EMEM);
break;
case LY_VLOG_LINE:
rc = asprintf(path, "Line number %"PRIu64".", *((uint64_t*)elem));
LY_CHECK_ERR_RET(rc == -1, LOGMEM(ctx), LY_EMEM);
break;
+ case LY_VLOG_LYSC:
+ *path = lysc_path(elem, LYSC_PATH_LOG, NULL, 0);
+ LY_CHECK_ERR_RET(!(*path), LOGMEM(ctx), LY_EMEM);
+ break;
default:
/* shouldn't be here */
LOGINT_RET(ctx);
diff --git a/src/tree_schema_compile.c b/src/tree_schema_compile.c
index 29d238a..5411bc7 100644
--- a/src/tree_schema_compile.c
+++ b/src/tree_schema_compile.c
@@ -6998,7 +6998,7 @@
ret = lyxp_atomize(when->cond, LYD_UNKNOWN, when->module, when->context,
when->context ? LYXP_NODE_ELEM : LYXP_NODE_ROOT_CONFIG, &tmp_set, LYXP_SCNODE_SCHEMA);
if (ret != LY_SUCCESS) {
- LOGVAL(set->ctx, LY_VLOG_LYS, node, LYVE_SEMANTICS, "Invalid when condition \"%s\".", when->cond->expr);
+ LOGVAL(set->ctx, LY_VLOG_LYSC, node, LYVE_SEMANTICS, "Invalid when condition \"%s\".", when->cond->expr);
goto cleanup;
}
@@ -7008,7 +7008,7 @@
/* try to find this node in our set */
idx = lyxp_set_scnode_dup_node_check(set, tmp_set.val.scnodes[k].scnode, LYXP_NODE_ELEM, -1);
if ((idx > -1) && (set->val.scnodes[idx].in_ctx == -1)) {
- LOGVAL(set->ctx, LY_VLOG_LYS, node, LY_VCODE_CIRC_WHEN, node->name, set->val.scnodes[idx].scnode->name);
+ LOGVAL(set->ctx, LY_VLOG_LYSC, node, LY_VCODE_CIRC_WHEN, node->name, set->val.scnodes[idx].scnode->name);
ret = LY_EVALID;
goto cleanup;
}
@@ -7102,7 +7102,7 @@
ret = lyxp_atomize(when[i]->cond, LYD_UNKNOWN, when[i]->module, when[i]->context,
when[i]->context ? LYXP_NODE_ELEM : LYXP_NODE_ROOT_CONFIG, &tmp_set, opts);
if (ret != LY_SUCCESS) {
- LOGVAL(ctx->ctx, LY_VLOG_LYS, node, LYVE_SEMANTICS, "Invalid when condition \"%s\".", when[i]->cond->expr);
+ LOGVAL(ctx->ctx, LY_VLOG_LYSC, node, LYVE_SEMANTICS, "Invalid when condition \"%s\".", when[i]->cond->expr);
goto cleanup;
}
@@ -7120,7 +7120,7 @@
/* check dummy node accessing */
if (schema == node) {
- LOGVAL(ctx->ctx, LY_VLOG_LYS, node, LY_VCODE_DUMMY_WHEN, node->name);
+ LOGVAL(ctx->ctx, LY_VLOG_LYSC, node, LY_VCODE_DUMMY_WHEN, node->name);
ret = LY_EVALID;
goto cleanup;
}
@@ -7139,7 +7139,7 @@
LY_ARRAY_FOR(musts, i) {
ret = lyxp_atomize(musts[i].cond, LYD_UNKNOWN, musts[i].module, node, LYXP_NODE_ELEM, &tmp_set, opts);
if (ret != LY_SUCCESS) {
- LOGVAL(ctx->ctx, LY_VLOG_LYS, node, LYVE_SEMANTICS, "Invalid must restriction \"%s\".", musts[i].cond->expr);
+ LOGVAL(ctx->ctx, LY_VLOG_LYSC, node, LYVE_SEMANTICS, "Invalid must restriction \"%s\".", musts[i].cond->expr);
goto cleanup;
}
diff --git a/src/xpath.c b/src/xpath.c
index e234385..580f477 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -5492,7 +5492,7 @@
}
if (set->type != LYXP_SET_SCNODE_SET) {
- LOGVAL(set->ctx, LY_VLOG_LYS, set->ctx_scnode, LY_VCODE_XP_INOP_1, "path operator", print_set_type(set));
+ LOGVAL(set->ctx, LY_VLOG_LYSC, set->ctx_scnode, LY_VCODE_XP_INOP_1, "path operator", print_set_type(set));
return LY_EVALID;
}
@@ -5699,7 +5699,7 @@
}
if (set->type != LYXP_SET_SCNODE_SET) {
- LOGVAL(set->ctx, LY_VLOG_LYS, set->ctx_scnode, LY_VCODE_XP_INOP_1, "path operator", print_set_type(set));
+ LOGVAL(set->ctx, LY_VLOG_LYSC, set->ctx_scnode, LY_VCODE_XP_INOP_1, "path operator", print_set_type(set));
return LY_EVALID;
}
@@ -6139,7 +6139,7 @@
}
if (set->type != LYXP_SET_SCNODE_SET) {
- LOGVAL(set->ctx, LY_VLOG_LYS, set->ctx_scnode, LY_VCODE_XP_INOP_1, "path operator", print_set_type(set));
+ LOGVAL(set->ctx, LY_VLOG_LYSC, set->ctx_scnode, LY_VCODE_XP_INOP_1, "path operator", print_set_type(set));
return LY_EVALID;
}
@@ -6287,7 +6287,7 @@
}
if (set->type != LYXP_SET_SCNODE_SET) {
- LOGVAL(set->ctx, LY_VLOG_LYS, set->ctx_scnode, LY_VCODE_XP_INOP_1, "path operator", print_set_type(set));
+ LOGVAL(set->ctx, LY_VLOG_LYSC, set->ctx_scnode, LY_VCODE_XP_INOP_1, "path operator", print_set_type(set));
return LY_EVALID;
}
diff --git a/tests/src/test_tree_schema_compile.c b/tests/src/test_tree_schema_compile.c
index 260e4dc..b699dc8 100644
--- a/tests/src/test_tree_schema_compile.c
+++ b/tests/src/test_tree_schema_compile.c
@@ -3461,7 +3461,7 @@
"}"
"}"
, LYS_IN_YANG));
- logbuf_assert("When condition of \"cont2\" includes a self-reference (referenced by when of \"l\").");
+ logbuf_assert("When condition of \"cont2\" includes a self-reference (referenced by when of \"l\"). /a:cont2");
assert_null(lys_parse_mem(ctx,
"module a {"
@@ -3489,7 +3489,7 @@
"}"
"}"
, LYS_IN_YANG));
- logbuf_assert("When condition of \"cont2\" includes a self-reference (referenced by when of \"val\").");
+ logbuf_assert("When condition of \"cont2\" includes a self-reference (referenced by when of \"val\"). /a:cont2");
assert_null(lys_parse_mem(ctx,
"module a {"
@@ -3501,7 +3501,7 @@
"}"
"}"
, LYS_IN_YANG));
- logbuf_assert("When condition of \"val\" is accessing its own conditional node.");
+ logbuf_assert("When condition of \"val\" is accessing its own conditional node. /a:val");
assert_null(lys_parse_mem(ctx,
"module a {"
@@ -3517,7 +3517,7 @@
"}"
"}"
, LYS_IN_YANG));
- logbuf_assert("When condition of \"val\" is accessing its own conditional node.");
+ logbuf_assert("When condition of \"val\" is accessing its own conditional node. /a:val");
assert_null(lys_parse_mem(ctx,
"module a {"
@@ -3532,7 +3532,7 @@
"container cont;"
"}"
, LYS_IN_YANG));
- logbuf_assert("When condition of \"val\" is accessing its own conditional node.");
+ logbuf_assert("When condition of \"val\" is accessing its own conditional node. /a:cont/val");
*state = NULL;
ly_ctx_destroy(ctx, NULL);