* Changed debug levels in clicon_debug() to be based on maskable flags
* Added flag names: `CLIXON_DBG_*`
* Added maskable flags that can be combined when debugging:
* `DEFAULT` = 1: Basic debug message, espcially initialization
* `MSG` = 2: Input and output packets, read datastore
* `DETAIL` = 4: Details: message dump in hex, xpath parse trees, etc
* `EXTRA` = 8: Extra detailed logs
* Test: some errors in yang-lib where content-id was in wrong place
This commit is contained in:
parent
8342b74968
commit
da9bfcbb53
47 changed files with 425 additions and 210 deletions
|
|
@ -201,12 +201,15 @@ transaction_clen(transaction_data td)
|
|||
return ((transaction_data_t *)td)->td_clen;
|
||||
}
|
||||
|
||||
/*! Print transaction on FILE for debug
|
||||
* @see transaction_log
|
||||
/*! Print info about transaction on FILE, including what has changed
|
||||
*
|
||||
* @param[in] f stdio FILE
|
||||
* @param[in] th Transaction data
|
||||
* @see transaction_dbg
|
||||
*/
|
||||
int
|
||||
transaction_print(FILE *f,
|
||||
transaction_data th)
|
||||
transaction_print(FILE *f,
|
||||
transaction_data th)
|
||||
{
|
||||
cxobj *xn;
|
||||
int i;
|
||||
|
|
@ -235,6 +238,66 @@ transaction_print(FILE *f,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*! Log debug info about transaction on FILE, including what has changed
|
||||
*
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] dbglevel Debuglevel as defined by CLIXON_DBG_* flags
|
||||
* @param[in] th Transaction data
|
||||
* @param[in] msg Debug msg tag
|
||||
*/
|
||||
int
|
||||
transaction_dbg(clicon_handle h,
|
||||
int dbglevel,
|
||||
transaction_data th,
|
||||
const char *msg)
|
||||
{
|
||||
cxobj *xn;
|
||||
int i;
|
||||
transaction_data_t *td;
|
||||
cbuf *cb = NULL;
|
||||
|
||||
td = (transaction_data_t *)th;
|
||||
if ((cb = cbuf_new()) == NULL){
|
||||
clicon_err(OE_CFG, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
for (i=0; i<td->td_dlen; i++){
|
||||
xn = td->td_dvec[i];
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, -1, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
if (i)
|
||||
clicon_debug(dbglevel, "%s %" PRIu64 " %s del: %s",
|
||||
__FUNCTION__, td->td_id, msg, cbuf_get(cb));
|
||||
cbuf_reset(cb);
|
||||
for (i=0; i<td->td_alen; i++){
|
||||
xn = td->td_avec[i];
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, -1, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
if (i)
|
||||
clicon_debug(dbglevel, "%s %" PRIu64 " %s add: %s",
|
||||
__FUNCTION__, td->td_id, msg, cbuf_get(cb));
|
||||
cbuf_reset(cb);
|
||||
for (i=0; i<td->td_clen; i++){
|
||||
if (td->td_scvec){
|
||||
xn = td->td_scvec[i];
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, -1, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
xn = td->td_tcvec[i];
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, -1, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
if (i)
|
||||
clicon_debug(dbglevel, "%s %" PRIu64 " %s change: %s",
|
||||
__FUNCTION__, td->td_id, msg, cbuf_get(cb));
|
||||
done:
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*! Log a transaction
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue