Skip to content

Commit

Permalink
Debug -D msg: dont show length in detailed debug
Browse files Browse the repository at this point in the history
  • Loading branch information
olofhagsand committed Nov 23, 2024
1 parent 0193186 commit 030dd89
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 16 deletions.
6 changes: 4 additions & 2 deletions apps/netconf/netconf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,10 @@ netconf_input_cb(int s,
cbmsg = NULL;
break;
}
clixon_debug(CLIXON_DBG_MSG, "Recv ext len: %lu", cbuf_len(cbmsg));
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "Recv ext: %s", cbuf_get(cbmsg));
if (clixon_debug_isset(CLIXON_DBG_DETAIL))
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "Recv ext: %s", cbuf_get(cbmsg));
else
clixon_debug(CLIXON_DBG_MSG, "Recv ext len: %lu", cbuf_len(cbmsg));
if ((ret = netconf_input_frame2(cbmsg, YB_RPC, yspec, &xtop, &xerr)) < 0)
goto done;
cbuf_reset(cbmsg);
Expand Down
6 changes: 4 additions & 2 deletions lib/src/clixon_netconf_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2203,8 +2203,10 @@ netconf_output(int s,
char *buf = cbuf_get(cb);
int len = cbuf_len(cb);

clixon_debug(CLIXON_DBG_MSG, "Send ext len: %lu", cbuf_len(cb));
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "Send ext: %s", cbuf_get(cb));
if (clixon_debug_isset(CLIXON_DBG_DETAIL))
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "Send ext: %s", cbuf_get(cb));
else
clixon_debug(CLIXON_DBG_MSG, "Send ext len: %lu", cbuf_len(cb));
#if 0 // Extra sanity check for debugging
{
cxobj *xt = NULL;
Expand Down
37 changes: 25 additions & 12 deletions lib/src/clixon_proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,12 +354,16 @@ clixon_msg_send(int s,
int retval = -1;

if (descr){
clixon_debug(CLIXON_DBG_MSG, "Send [%s] len: %lu", descr, cbuf_len(cb));
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "Send [%s] %s", descr, cbuf_get(cb));
if (clixon_debug_isset(CLIXON_DBG_DETAIL))
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "Send [%s] %s", descr, cbuf_get(cb));
else
clixon_debug(CLIXON_DBG_MSG, "Send [%s] len: %lu", descr, cbuf_len(cb));
}
else{
clixon_debug(CLIXON_DBG_MSG, "Send len: %lu", cbuf_len(cb));
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "Send %s", cbuf_get(cb));
if (clixon_debug_isset(CLIXON_DBG_DETAIL))
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "Send %s", cbuf_get(cb));
else
clixon_debug(CLIXON_DBG_MSG, "Send len: %lu", cbuf_len(cb));
}

if (atomicio((ssize_t (*)(int, void *, size_t))write,
Expand Down Expand Up @@ -433,12 +437,16 @@ clixon_msg_rcv10(int s,
}
else {
if (descr){
clixon_debug(CLIXON_DBG_MSG, "Recv [%s] len: %lu", descr, cbuf_len(cb));
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "Recv [%s]: %s", descr, cbuf_get(cb));
if (clixon_debug_isset(CLIXON_DBG_DETAIL))
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "Recv [%s]: %s", descr, cbuf_get(cb));
else
clixon_debug(CLIXON_DBG_MSG, "Recv [%s] len: %lu", descr, cbuf_len(cb));
}
else{
clixon_debug(CLIXON_DBG_MSG, "Recv len: %lu", cbuf_len(cb));
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "Recv: %s", cbuf_get(cb));
if (clixon_debug_isset(CLIXON_DBG_DETAIL))
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "Recv: %s", cbuf_get(cb));
else
clixon_debug(CLIXON_DBG_MSG, "Recv len: %lu", cbuf_len(cb));
}

}
Expand Down Expand Up @@ -612,12 +620,17 @@ clixon_msg_rcv11(int s,
}
else {
if (descr){
clixon_debug(CLIXON_DBG_MSG, "Recv [%s] len: %lu", descr, cbuf_len(cbmsg));
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "Recv [%s]: %s", descr, cbuf_get(cbmsg));
if (clixon_debug_isset(CLIXON_DBG_DETAIL))
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "Recv [%s]: %s", descr, cbuf_get(cbmsg));
else
clixon_debug(CLIXON_DBG_MSG, "Recv [%s] len: %lu", descr, cbuf_len(cbmsg));
}
else{
clixon_debug(CLIXON_DBG_MSG, "Recv len: %lu", cbuf_len(cbmsg));
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "Recv: %s", cbuf_get(cbmsg));
if (clixon_debug_isset(CLIXON_DBG_DETAIL))
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "Recv: %s", cbuf_get(cbmsg));
else
clixon_debug(CLIXON_DBG_MSG, "Recv len: %lu", cbuf_len(cbmsg));

}

}
Expand Down

0 comments on commit 030dd89

Please sign in to comment.