Replaced the global variable debug with access function: clicon_debug_get().
This commit is contained in:
parent
718f494549
commit
ff5462ecac
35 changed files with 227 additions and 100 deletions
|
|
@ -551,6 +551,7 @@ main(int argc,
|
|||
cvec *nsctx_global = NULL; /* Global namespace context */
|
||||
size_t cligen_buflen;
|
||||
size_t cligen_bufthreshold;
|
||||
int dbg = 0;
|
||||
|
||||
/* In the startup, logs to stderr & debug flag set later */
|
||||
clicon_log_init(__PROGRAM__, LOG_INFO, logdst);
|
||||
|
|
@ -567,7 +568,7 @@ main(int argc,
|
|||
usage(h, argv[0]);
|
||||
break;
|
||||
case 'D' : /* debug */
|
||||
if (sscanf(optarg, "%d", &debug) != 1)
|
||||
if (sscanf(optarg, "%d", &dbg) != 1)
|
||||
usage(h, argv[0]);
|
||||
break;
|
||||
case 'f': /* override config file */
|
||||
|
|
@ -587,9 +588,9 @@ main(int argc,
|
|||
/*
|
||||
* Logs, error and debug to stderr or syslog, set debug level
|
||||
*/
|
||||
clicon_log_init(__PROGRAM__, debug?LOG_DEBUG:LOG_INFO, logdst);
|
||||
clicon_log_init(__PROGRAM__, dbg?LOG_DEBUG:LOG_INFO, logdst);
|
||||
|
||||
clicon_debug_init(debug, NULL);
|
||||
clicon_debug_init(dbg, NULL);
|
||||
clicon_log(LOG_NOTICE, "%s: %u Started", __PROGRAM__, getpid());
|
||||
if (set_signal(SIGTERM, restconf_sig_term, NULL) < 0){
|
||||
clicon_err(OE_DAEMON, errno, "Setting signal");
|
||||
|
|
@ -737,8 +738,8 @@ main(int argc,
|
|||
goto done;
|
||||
|
||||
/* Dump configuration options on debug */
|
||||
if (debug)
|
||||
clicon_option_dump(h, debug);
|
||||
if (dbg)
|
||||
clicon_option_dump(h, dbg);
|
||||
|
||||
/* Call start function in all plugins before we go interactive
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ api_data_write(clicon_handle h,
|
|||
|
||||
}
|
||||
#if 0
|
||||
if (debug)
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, xret, "%s xret:", __FUNCTION__);
|
||||
#endif
|
||||
if (xml_child_nr(xret) == 0){ /* Object does not exist */
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ api_data_get2(clicon_handle h,
|
|||
* We need to cut that tree to only the object.
|
||||
*/
|
||||
#if 0 /* DEBUG */
|
||||
if (debug)
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, xret, "%s xret:", __FUNCTION__);
|
||||
#endif
|
||||
/* Check if error return */
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ api_data_post(clicon_handle h,
|
|||
if (restconf_insert_attributes(xdata, qvec) < 0)
|
||||
goto done;
|
||||
#if 1
|
||||
if (debug)
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, xdata, "%s xdata:", __FUNCTION__);
|
||||
#endif
|
||||
|
||||
|
|
@ -512,7 +512,7 @@ api_operations_post_input(clicon_handle h,
|
|||
* <data><input xmlns="urn:example:clixon">...</input></data>
|
||||
*/
|
||||
#if 1
|
||||
if (debug)
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, xdata, "%s xdata:", __FUNCTION__);
|
||||
#endif
|
||||
/* Validate that exactly only <input> tag */
|
||||
|
|
@ -614,7 +614,7 @@ api_operations_post_output(clicon_handle h,
|
|||
xml_name_set(xoutput, "output");
|
||||
/* xoutput should now look: <output><x xmlns="uri">0</x></output> */
|
||||
#if 1
|
||||
if (debug)
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, xoutput, "%s xoutput:", __FUNCTION__);
|
||||
#endif
|
||||
|
||||
|
|
@ -843,7 +843,7 @@ api_operations_post(clicon_handle h,
|
|||
/* Here xtop is:
|
||||
<rpc username="foo"><myfn xmlns="uri"><x>42</x></myfn></rpc> */
|
||||
#if 1
|
||||
if (debug)
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, xtop, "%s 5. Translate input args:", __FUNCTION__);
|
||||
#endif
|
||||
/* 6. Validate outgoing RPC and fill in defaults */
|
||||
|
|
@ -874,7 +874,7 @@ api_operations_post(clicon_handle h,
|
|||
* <rpc username="foo"><myfn xmlns="uri"><x>42</x><y>99</y></myfn></rpc>
|
||||
*/
|
||||
#if 0
|
||||
if (debug)
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, xtop, "%s 6. Validate and defaults:", __FUNCTION__);
|
||||
#endif
|
||||
/* 7. Send to RPC handler, either local or backend
|
||||
|
|
@ -909,7 +909,7 @@ api_operations_post(clicon_handle h,
|
|||
* <rpc-reply><x xmlns="uri">0</x></rpc-reply>
|
||||
*/
|
||||
#if 1
|
||||
if (debug)
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, xret, "%s Receive reply:", __FUNCTION__);
|
||||
#endif
|
||||
youtput = yang_find(yrpc, Y_OUTPUT, NULL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue