Messages can't be DETAIL alone so pair with DEFAULT

This commit is contained in:
Philip Prindeville 2024-01-04 14:39:42 -07:00 committed by Olof Hagsand
parent 7e0075dcbb
commit 063c8d664f
24 changed files with 84 additions and 83 deletions

View file

@ -161,7 +161,7 @@ static clixon_path *
path_append(clixon_path *list,
clixon_path *new)
{
clixon_debug(CLIXON_DBG_DETAIL, "%s()", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s()", __FUNCTION__);
if (new == NULL)
return NULL;
ADDQ(new, list);
@ -174,7 +174,7 @@ static clixon_path *
path_add_keyvalue(clixon_path *cp,
cvec *cvk)
{
clixon_debug(CLIXON_DBG_DETAIL, "%s()", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s()", __FUNCTION__);
if (cp)
cp->cp_cvk = cvk;
return cp;
@ -186,7 +186,7 @@ path_new(char *module_name,
{
clixon_path *cp = NULL;
clixon_debug(CLIXON_DBG_DETAIL, "%s(%s,%s)", __FUNCTION__, module_name, id);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s(%s,%s)", __FUNCTION__, module_name, id);
if ((cp = malloc(sizeof(*cp))) == NULL){
clixon_err(OE_UNIX, errno, "malloc");
goto done;
@ -217,7 +217,7 @@ static cvec *
keyval_add(cvec *cvv,
cg_var *cv)
{
clixon_debug(CLIXON_DBG_DETAIL, "%s()", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s()", __FUNCTION__);
if (cv == NULL)
goto done;
if (cvv == NULL &&
@ -243,7 +243,7 @@ keyval_set(char *name,
{
cg_var *cv = NULL;
clixon_debug(CLIXON_DBG_DETAIL, "%s(%s=%s)", __FUNCTION__, name?name:"NULL", val);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s(%s=%s)", __FUNCTION__, name?name:"NULL", val);
if ((cv = cv_new(CGV_STRING)) == NULL){
clixon_err(OE_UNIX, errno, "cv_new");
goto done;

View file

@ -384,7 +384,7 @@ xmldb_exists(clixon_handle h,
char *filename = NULL;
struct stat sb;
clixon_debug(CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, db);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, db);
if (xmldb_db2file(h, db, &filename) < 0)
goto done;
if (lstat(filename, &sb) < 0)
@ -442,7 +442,7 @@ xmldb_delete(clixon_handle h,
char *filename = NULL;
struct stat sb;
clixon_debug(CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, db);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, db);
if (xmldb_clear(h, db) < 0)
goto done;
if (xmldb_db2file(h, db, &filename) < 0)
@ -476,7 +476,7 @@ xmldb_create(clixon_handle h,
db_elmnt *de = NULL;
cxobj *xt = NULL;
clixon_debug(CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, db);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, db);
if ((de = clicon_db_elmnt_get(h, db)) != NULL){
if ((xt = de->de_xml) != NULL){
xml_free(xt);

View file

@ -859,13 +859,14 @@ xmldb_get_nocache(clixon_handle h,
if (disable_nacm_on_empty(xt, yspec) < 0)
goto done;
}
if (clixon_debug_get()>1)
if (clixon_debug_isset(CLIXON_DBG_DEFAULT))
if (clixon_xml2file(stderr, xt, 0, 1, NULL, fprintf, 0, 0) < 0)
goto done;
*xtop = xt;
xt = NULL;
retval = 1;
done:
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
if (xt)
xml_free(xt);
if (xvec)
@ -1053,11 +1054,11 @@ xmldb_get_cache(clixon_handle h,
if (disable_nacm_on_empty(x1t, yspec) < 0)
goto done;
}
clixon_debug_xml(CLIXON_DBG_DETAIL, x1t, "%s", __FUNCTION__);
clixon_debug_xml(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, x1t, "%s", __FUNCTION__);
*xtop = x1t;
retval = 1;
done:
clixon_debug(CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
if (xvec)
free(xvec);
return retval;
@ -1202,13 +1203,13 @@ xmldb_get_zerocopy(clixon_handle h,
if (disable_nacm_on_empty(x0t, yspec) < 0)
goto done;
}
if (clixon_debug_get() > 1)
if (clixon_debug_isset(CLIXON_DBG_DEFAULT))
if (clixon_xml2file(stderr, x0t, 0, 1, NULL, fprintf, 0, 0) < 0)
goto done;
*xtop = x0t;
retval = 1;
done:
clixon_debug(CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
if (xvec)
free(xvec);
return retval;

View file

@ -199,7 +199,7 @@ clixon_event_reg_fd(int fd,
e->e_type = EVENT_FD;
e->e_next = ee;
ee = e;
clixon_debug(CLIXON_DBG_DETAIL, "%s, registering %s", __FUNCTION__, e->e_string);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s, registering %s", __FUNCTION__, e->e_string);
return 0;
}
@ -293,7 +293,7 @@ clixon_event_reg_timeout(struct timeval t,
}
e->e_next = e1;
*e_prev = e;
clixon_debug(CLIXON_DBG_DETAIL, "%s: %s", __FUNCTION__, str);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s: %s", __FUNCTION__, str);
retval = 0;
done:
return retval;
@ -435,7 +435,7 @@ clixon_event_loop(clixon_handle h)
if (n==0){ /* Timeout */
e = ee_timers;
ee_timers = ee_timers->e_next;
clixon_debug(CLIXON_DBG_DETAIL, "%s timeout: %s", __FUNCTION__, e->e_string);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s timeout: %s", __FUNCTION__, e->e_string);
if ((*e->e_fn)(0, e->e_arg) < 0){
free(e);
goto err;
@ -449,7 +449,7 @@ clixon_event_loop(clixon_handle h)
}
e_next = e->e_next;
if(e->e_type == EVENT_FD && FD_ISSET(e->e_fd, &fdset)){
clixon_debug(CLIXON_DBG_DETAIL, "%s: FD_ISSET: %s", __FUNCTION__, e->e_string);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s: FD_ISSET: %s", __FUNCTION__, e->e_string);
if ((*e->e_fn)(e->e_fd, e->e_arg) < 0){
clixon_debug(CLIXON_DBG_DEFAULT, "%s Error in: %s", __FUNCTION__, e->e_string);
goto err;

View file

@ -150,7 +150,7 @@ clicon_files_recursive(const char *dir,
int res = 0;
char errbuf[128];
clixon_debug(CLIXON_DBG_DETAIL, "%s dir:%s", __FUNCTION__, dir);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s dir:%s", __FUNCTION__, dir);
if (regexp && (res = regcomp(&re, regexp, REG_EXTENDED)) != 0) {
regerror(res, &re, errbuf, sizeof(errbuf));
clixon_err(OE_DB, 0, "regcomp: %s", errbuf);
@ -243,7 +243,7 @@ clicon_file_dirent(const char *dir,
clixon_err(OE_UNIX, errno, "realloc");
goto quit;
} /* realloc */
clixon_debug(CLIXON_DBG_DETAIL, "%s memcpy(%p %p %u", __FUNCTION__, &new[nent], dent, direntStructSize);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s memcpy(%p %p %u", __FUNCTION__, &new[nent], dent, direntStructSize);
/* man (3) readdir:
* By implication, the use sizeof(struct dirent) to capture the size of the record including
* the size of d_name is also incorrect. */

View file

@ -167,7 +167,7 @@ static clixon_path *
path_append(clixon_path *list,
clixon_path *new)
{
clixon_debug(CLIXON_DBG_DETAIL, "%s()", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s()", __FUNCTION__);
if (new == NULL)
return NULL;
ADDQ(new, list);
@ -183,7 +183,7 @@ static clixon_path *
path_add_keyvalue(clixon_path *cp,
cvec *cvk)
{
clixon_debug(CLIXON_DBG_DETAIL, "%s()", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s()", __FUNCTION__);
if (cp == NULL)
goto done;
cp->cp_cvk = cvk;
@ -197,7 +197,7 @@ path_new(char *prefix,
{
clixon_path *cp = NULL;
clixon_debug(CLIXON_DBG_DETAIL, "%s(%s,%s)", __FUNCTION__, prefix, id);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s(%s,%s)", __FUNCTION__, prefix, id);
if ((cp = malloc(sizeof(*cp))) == NULL){
clixon_err(OE_UNIX, errno, "malloc");
goto done;
@ -227,7 +227,7 @@ keyval_pos(char *uint)
char *reason=NULL;
int ret;
clixon_debug(CLIXON_DBG_DETAIL, "%s(%s)", __FUNCTION__, uint);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s(%s)", __FUNCTION__, uint);
if ((cvv = cvec_new(1)) == NULL) {
clixon_err(OE_UNIX, errno, "cvec_new");
goto done;
@ -261,7 +261,7 @@ static cvec *
keyval_add(cvec *cvv,
cg_var *cv)
{
clixon_debug(CLIXON_DBG_DETAIL, "%s()", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s()", __FUNCTION__);
if (cv == NULL)
goto done;
if (cvv == NULL &&
@ -287,7 +287,7 @@ keyval_set(char *name,
{
cg_var *cv = NULL;
clixon_debug(CLIXON_DBG_DETAIL, "%s(%s=%s)", __FUNCTION__, name, val);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s(%s=%s)", __FUNCTION__, name, val);
if ((cv = cv_new(CGV_STRING)) == NULL){
clixon_err(OE_UNIX, errno, "cv_new");
goto done;

View file

@ -188,7 +188,7 @@ json_current_new(clixon_json_yacc *jy,
char *prefix = NULL;
char *id = NULL;
clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
/* Find colon separator and if found split into prefix:name */
if (nodeid_split(name, &prefix, &id) < 0)
goto done;
@ -215,7 +215,7 @@ json_current_new(clixon_json_yacc *jy,
static int
json_current_pop(clixon_json_yacc *jy)
{
clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
if (jy->jy_current)
jy->jy_current = xml_parent(jy->jy_current);
return 0;
@ -226,7 +226,7 @@ json_current_clone(clixon_json_yacc *jy)
{
cxobj *xn;
clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
if (jy->jy_current == NULL){
return -1;
}
@ -258,7 +258,7 @@ json_current_body(clixon_json_yacc *jy,
int retval = -1;
cxobj *xn;
clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
if ((xn = xml_new("body", jy->jy_current, CX_BODY)) == NULL)
goto done;
if (value && xml_value_append(xn, value) < 0)

View file

@ -103,14 +103,14 @@ netconf_input_read2(int s,
goto done;
}
} /* read */
clixon_debug(CLIXON_DBG_DETAIL, "%s len:%ld", __FUNCTION__, len);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s len:%ld", __FUNCTION__, len);
if (len == 0){ /* EOF */
clixon_debug(CLIXON_DBG_DETAIL, "%s len==0, closing", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s len==0, closing", __FUNCTION__);
*eof = 1;
}
retval = len;
done:
clixon_debug(CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
return retval;
}
@ -147,7 +147,7 @@ netconf_input_msg2(unsigned char **bufp,
size_t len;
char ch;
clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
len = *lenp;
for (i=0; i<len; i++){
if ((ch = (*bufp)[i]) == 0)
@ -190,7 +190,7 @@ netconf_input_msg2(unsigned char **bufp,
*eom = found;
retval = 0;
done:
clixon_debug(CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
return retval;
}
@ -218,7 +218,7 @@ netconf_input_frame2(cbuf *cb,
cxobj *xtop = NULL; /* Request (in) */
int ret;
clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
if (xrecv == NULL){
clixon_err(OE_PLUGIN, EINVAL, "xrecv is NULL");
goto done;

View file

@ -2245,7 +2245,7 @@ netconf_input_chunked_framing(char ch,
{
int retval = 0;
clixon_debug(CLIXON_DBG_DETAIL, "%s ch:%c(%d) state:%d size:%zu", __FUNCTION__, ch, ch, *state, *size);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s ch:%c(%d) state:%d size:%zu", __FUNCTION__, ch, ch, *state, *size);
switch (*state){
case 0:
if (ch == '\n'){

View file

@ -268,7 +268,7 @@ parse_configfile_one(clixon_handle h,
clixon_err(OE_UNIX, errno, "open configure file: %s", filename);
return -1;
}
clixon_debug(CLIXON_DBG_DETAIL, "%s: Reading config file %s", __FUNCTION__, filename);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s: Reading config file %s", __FUNCTION__, filename);
if ((ret = clixon_xml_parse_file(fp, yspec?YB_MODULE:YB_NONE, yspec, &xt, &xerr)) < 0)
goto done;
if (ret == 0){
@ -293,7 +293,7 @@ parse_configfile_one(clixon_handle h,
xt = NULL;
retval = 0;
done:
clixon_debug(CLIXON_DBG_DETAIL, "%s: Done w/ config file %s returning %d", __FUNCTION__, filename, retval);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s: Done w/ config file %s returning %d", __FUNCTION__, filename, retval);
if (xt)
xml_free(xt);
if (fp)
@ -416,7 +416,7 @@ parse_configfile(clixon_handle h,
goto done;
}
clixon_debug(CLIXON_DBG_DETAIL, "%s: Reading config file %s", __FUNCTION__, filename);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s: Reading config file %s", __FUNCTION__, filename);
/* Parse main config file */
if (parse_configfile_one(h, filename, yspec, &xt) < 0)
goto done;
@ -504,7 +504,7 @@ parse_configfile(clixon_handle h,
*xconfig = xt;
xt = NULL;
done:
clixon_debug(CLIXON_DBG_DETAIL, "%s: Done w/ config file %s returning %d", __FUNCTION__, filename, retval);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s: Done w/ config file %s returning %d", __FUNCTION__, filename, retval);
if (dp)
free(dp);
if (nsc)

View file

@ -418,7 +418,7 @@ clixon_plugins_load(clixon_handle h,
plugin_module_struct *ms = plugin_module_struct_get(h);
int dlflags;
clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
if (ms == NULL){
clixon_err(OE_PLUGIN, EINVAL, "plugin module not initialized");
goto done;
@ -1302,7 +1302,7 @@ rpc_callback_call(clixon_handle h,
*nrp = nr;
retval = 1; /* 0: none found, >0 nr of handlers called */
done:
clixon_debug(CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
return retval;
fail:
retval = 0;

View file

@ -1016,7 +1016,7 @@ clixon_process_sched_register(clixon_handle h,
struct timeval t;
struct timeval t1 = {0, 100000}; /* 100ms */
clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
gettimeofday(&t, NULL);
if (delay)
timeradd(&t, &t1, &t);
@ -1024,7 +1024,7 @@ clixon_process_sched_register(clixon_handle h,
goto done;
retval = 0;
done:
clixon_debug(CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
return retval;
}

View file

@ -206,7 +206,7 @@ clicon_rpc_msg(clixon_handle h,
int s = -1;
int eof = 0;
clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
#ifdef RPC_USERNAME_ASSERT
assert(strstr(msg->op_body, "username")!=NULL); /* XXX */
#endif
@ -253,7 +253,7 @@ clicon_rpc_msg(clixon_handle h,
}
retval = 0;
done:
clixon_debug(CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, retval);
if (retdata)
free(retdata);
if (xret)
@ -1018,7 +1018,7 @@ clicon_rpc_get2(clixon_handle h,
yang_stmt *yspec;
cvec *nscd = NULL;
clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
if (session_id_check(h, &session_id) < 0)
goto done;
if ((cb = cbuf_new()) == NULL){
@ -1105,7 +1105,7 @@ clicon_rpc_get2(clixon_handle h,
}
retval = 0;
done:
clixon_debug(CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s %d", __FUNCTION__, retval);
if (nscd)
cvec_free(nscd);
if (cb)

View file

@ -267,7 +267,7 @@ stream_timer_setup(int fd,
struct stream_replay *r;
struct stream_replay *r1;
clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
/* Go thru callbacks and see if any have timed out, if so remove them
* Could also be done by a separate timer.
*/
@ -519,7 +519,7 @@ stream_notify1(clixon_handle h,
int retval = -1;
struct stream_subscription *ss;
clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
/* Go thru all subscriptions and find matches */
if ((ss = es->es_subscription) != NULL)
do {
@ -575,7 +575,7 @@ stream_notify(clixon_handle h,
struct timeval tv;
event_stream_t *es;
clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
if ((es = stream_find(h, stream)) == NULL)
goto ok;
va_start(args, event);
@ -652,7 +652,7 @@ stream_notify_xml(clixon_handle h,
struct timeval tv;
event_stream_t *es;
clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
if ((es = stream_find(h, stream)) == NULL)
goto ok;
if ((yspec = clicon_dbspec_yang(h)) == NULL){