Symbolic and combined debug names in cmd-line of all applications

New debug levels: BACKEND, CLI, NETCONF,RESTCONF, SNMP, STREAM
This commit is contained in:
Olof hagsand 2024-02-02 11:47:01 +01:00
parent 86f251f343
commit 4e3bd6fbdd
39 changed files with 564 additions and 416 deletions

View file

@ -128,7 +128,7 @@ api_data_get2(clixon_handle h,
char *defaults = NULL;
cvec *nscd = NULL;
clixon_debug(CLIXON_DBG_CLIENT, "");
clixon_debug(CLIXON_DBG_RESTCONF, "");
if ((yspec = clicon_dbspec_yang(h)) == NULL){
clixon_err(OE_FATAL, 0, "No DB_SPEC");
goto done;
@ -168,7 +168,7 @@ api_data_get2(clixon_handle h,
}
/* Check for content attribute */
if ((attr = cvec_find_str(qvec, "content")) != NULL){
clixon_debug(CLIXON_DBG_CLIENT, "content=%s", attr);
clixon_debug(CLIXON_DBG_RESTCONF, "content=%s", attr);
if ((int)(content = netconf_content_str2int(attr)) == -1){
if (netconf_bad_attribute_xml(&xerr, "application",
"content", "Unrecognized value of content attribute") < 0)
@ -180,7 +180,7 @@ api_data_get2(clixon_handle h,
}
/* Check for depth attribute */
if ((attr = cvec_find_str(qvec, "depth")) != NULL){
clixon_debug(CLIXON_DBG_CLIENT, "depth=%s", attr);
clixon_debug(CLIXON_DBG_RESTCONF, "depth=%s", attr);
if (strcmp(attr, "unbounded") != 0){
char *reason = NULL;
if ((ret = parse_int32(attr, &depth, &reason)) < 0){
@ -198,11 +198,11 @@ api_data_get2(clixon_handle h,
}
}
if ((attr = cvec_find_str(qvec, "with-defaults")) != NULL){
clixon_debug(CLIXON_DBG_CLIENT, "with_defaults=%s", attr);
clixon_debug(CLIXON_DBG_RESTCONF, "with_defaults=%s", attr);
defaults = attr;
}
clixon_debug(CLIXON_DBG_CLIENT, "path:%s", xpath);
clixon_debug(CLIXON_DBG_RESTCONF, "path:%s", xpath);
ret = clicon_rpc_get(h, xpath, nsc, content, depth, defaults, &xret);
if (ret < 0){
@ -217,7 +217,7 @@ api_data_get2(clixon_handle h,
*/
#if 0 /* DEBUG */
if (clixon_debug_get())
clixon_debug_xml(CLIXON_DBG_CLIENT, xret, "xret:");
clixon_debug_xml(CLIXON_DBG_RESTCONF, xret, "xret:");
#endif
/* Check if error return */
if ((xe = xpath_first(xret, NULL, "//rpc-error")) != NULL){
@ -292,7 +292,7 @@ api_data_get2(clixon_handle h,
break;
}
}
clixon_debug(CLIXON_DBG_CLIENT, "cbuf:%s", cbuf_get(cbx));
clixon_debug(CLIXON_DBG_RESTCONF, "cbuf:%s", cbuf_get(cbx));
if (restconf_reply_header(req, "Content-Type", "%s", restconf_media_int2str(media_out)) < 0)
goto done;
if (restconf_reply_header(req, "Cache-Control", "no-cache") < 0)
@ -303,7 +303,7 @@ api_data_get2(clixon_handle h,
ok:
retval = 0;
done:
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
clixon_debug(CLIXON_DBG_RESTCONF, "retval:%d", retval);
if (xpath)
free(xpath);
if (nscd)
@ -380,7 +380,7 @@ api_data_pagination(clixon_handle h,
char *where;
char *ns;
clixon_debug(CLIXON_DBG_CLIENT, "");
clixon_debug(CLIXON_DBG_RESTCONF, "");
if ((yspec = clicon_dbspec_yang(h)) == NULL){
clixon_err(OE_FATAL, 0, "No DB_SPEC");
goto done;
@ -429,7 +429,7 @@ api_data_pagination(clixon_handle h,
/* Check for content attribute */
if ((attr = cvec_find_str(qvec, "content")) != NULL){
clixon_debug(CLIXON_DBG_CLIENT, "content=%s", attr);
clixon_debug(CLIXON_DBG_RESTCONF, "content=%s", attr);
if ((int)(content = netconf_content_str2int(attr)) == -1){
if (netconf_bad_attribute_xml(&xerr, "application",
"content", "Unrecognized value of content attribute") < 0)
@ -443,7 +443,7 @@ api_data_pagination(clixon_handle h,
goto ok;
}
}
clixon_debug(CLIXON_DBG_CLIENT, "path:%s", xpath);
clixon_debug(CLIXON_DBG_RESTCONF, "path:%s", xpath);
if (content != CONTENT_CONFIG && content != CONTENT_NONCONFIG && content != CONTENT_ALL){
clixon_err(OE_XML, EINVAL, "Invalid content attribute %d", content);
goto done;
@ -451,7 +451,7 @@ api_data_pagination(clixon_handle h,
/* Clixon extensions and collection attributes */
/* Check for depth attribute */
if ((attr = cvec_find_str(qvec, "depth")) != NULL){
clixon_debug(CLIXON_DBG_CLIENT, "depth=%s", attr);
clixon_debug(CLIXON_DBG_RESTCONF, "depth=%s", attr);
if (strcmp(attr, "unbounded") != 0){
char *reason = NULL;
if ((ret = parse_int32(attr, &depth, &reason)) < 0){
@ -506,7 +506,7 @@ api_data_pagination(clixon_handle h,
* We need to cut that tree to only the object.
*/
#if 0 /* DEBUG */
clixon_debug_xml(CLIXON_DBG_CLIENT, xret, "xret:");
clixon_debug_xml(CLIXON_DBG_RESTCONF, xret, "xret:");
#endif
/* Check if error return */
if ((xe = xpath_first(xret, NULL, "//rpc-error")) != NULL){
@ -555,7 +555,7 @@ api_data_pagination(clixon_handle h,
default:
break;
}
clixon_debug(CLIXON_DBG_CLIENT, "cbuf:%s", cbuf_get(cbx));
clixon_debug(CLIXON_DBG_RESTCONF, "cbuf:%s", cbuf_get(cbx));
if (restconf_reply_header(req, "Content-Type", "%s", restconf_media_int2str(media_out)) < 0)
goto done;
if (restconf_reply_header(req, "Cache-Control", "no-cache") < 0)
@ -566,7 +566,7 @@ api_data_pagination(clixon_handle h,
ok:
retval = 0;
done:
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
clixon_debug(CLIXON_DBG_RESTCONF, "retval:%d", retval);
if (xpath)
free(xpath);
if (nsc)
@ -718,7 +718,7 @@ api_operations_get(clixon_handle h,
cxobj *xt = NULL;
int i;
clixon_debug(CLIXON_DBG_CLIENT, "");
clixon_debug(CLIXON_DBG_RESTCONF, "");
yspec = clicon_dbspec_yang(h);
if ((cbx = cbuf_new()) == NULL)
goto done;
@ -786,7 +786,7 @@ api_operations_get(clixon_handle h,
// ok:
retval = 0;
done:
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
clixon_debug(CLIXON_DBG_RESTCONF, "retval:%d", retval);
if (cbx)
cbuf_free(cbx);
if (xt)