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
|
|
@ -1066,7 +1066,7 @@ from_client_get(clicon_handle h,
|
|||
(ret = xml_yang_validate_add(h, xret, &xerr)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
if (debug)
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, xret, "VALIDATE_STATE");
|
||||
if (clixon_netconf_internal_error(xerr,
|
||||
". Internal error, state callback returned invalid XML",
|
||||
|
|
@ -1362,7 +1362,7 @@ from_client_debug(clicon_handle h,
|
|||
|
||||
clicon_debug_init(level, NULL); /* 0: dont debug, 1:debug */
|
||||
setlogmask(LOG_UPTO(level?LOG_DEBUG:LOG_INFO)); /* for syslog */
|
||||
clicon_log(LOG_NOTICE, "%s debug:%d", __FUNCTION__, debug);
|
||||
clicon_log(LOG_NOTICE, "%s debug:%d", __FUNCTION__, clicon_debug_get());
|
||||
cprintf(cbret, "<rpc-reply><ok/></rpc-reply>");
|
||||
ok:
|
||||
retval = 0;
|
||||
|
|
|
|||
|
|
@ -453,7 +453,7 @@ from_validate_common(clicon_handle h,
|
|||
&td->td_tcvec, /* changed: wanted values */
|
||||
&td->td_clen) < 0)
|
||||
goto done;
|
||||
if (debug>1)
|
||||
if (clicon_debug_get()>1)
|
||||
transaction_print(stderr, td);
|
||||
/* Mark as changed in tree */
|
||||
for (i=0; i<td->td_dlen; i++){ /* Also down */
|
||||
|
|
|
|||
|
|
@ -461,6 +461,7 @@ main(int argc,
|
|||
cvec *nsctx_global = NULL; /* Global namespace context */
|
||||
size_t cligen_buflen;
|
||||
size_t cligen_bufthreshold;
|
||||
int dbg;
|
||||
|
||||
/* In the startup, logs to stderr & syslog and debug flag set later */
|
||||
clicon_log_init(__PROGRAM__, LOG_INFO, logdst);
|
||||
|
|
@ -472,6 +473,7 @@ main(int argc,
|
|||
once = 0;
|
||||
zap = 0;
|
||||
extraxml_file = NULL;
|
||||
dbg = 0;
|
||||
|
||||
/*
|
||||
* Command-line options for help, debug, and config-file
|
||||
|
|
@ -489,7 +491,7 @@ main(int argc,
|
|||
help = 1;
|
||||
break;
|
||||
case 'D' : /* debug */
|
||||
if (sscanf(optarg, "%d", &debug) != 1)
|
||||
if (sscanf(optarg, "%d", &dbg) != 1)
|
||||
usage(h, argv[0]);
|
||||
break;
|
||||
case 'f': /* config file */
|
||||
|
|
@ -513,8 +515,8 @@ main(int argc,
|
|||
* XXX: if started in a start-daemon script, there will be irritating
|
||||
* double syslogs until fork below.
|
||||
*/
|
||||
clicon_log_init(__PROGRAM__, debug?LOG_DEBUG:LOG_INFO, logdst);
|
||||
clicon_debug_init(debug, NULL);
|
||||
clicon_log_init(__PROGRAM__, dbg?LOG_DEBUG:LOG_INFO, logdst);
|
||||
clicon_debug_init(dbg, NULL);
|
||||
|
||||
/* Find and read configfile */
|
||||
if (clicon_options_main(h) < 0){
|
||||
|
|
@ -622,7 +624,7 @@ main(int argc,
|
|||
/* Access the remaining argv/argc options (after --) w clicon-argv_get() */
|
||||
clicon_argv_set(h, argv0, argc, argv);
|
||||
|
||||
clicon_log_init(__PROGRAM__, debug?LOG_DEBUG:LOG_INFO, logdst);
|
||||
clicon_log_init(__PROGRAM__, dbg?LOG_DEBUG:LOG_INFO, logdst);
|
||||
|
||||
/* Defer: Wait to the last minute to print help message */
|
||||
if (help)
|
||||
|
|
@ -880,7 +882,7 @@ main(int argc,
|
|||
demonized errors OK. Before this stage, errors are logged on stderr
|
||||
also */
|
||||
if (foreground==0){
|
||||
clicon_log_init(__PROGRAM__, debug?LOG_DEBUG:LOG_INFO,
|
||||
clicon_log_init(__PROGRAM__, dbg?LOG_DEBUG:LOG_INFO,
|
||||
logdst==CLICON_LOG_FILE?CLICON_LOG_FILE:CLICON_LOG_SYSLOG);
|
||||
if (daemon(0, 0) < 0){
|
||||
fprintf(stderr, "config: daemon");
|
||||
|
|
@ -911,8 +913,8 @@ main(int argc,
|
|||
goto done;
|
||||
if (clicon_socket_set(h, ss) < 0)
|
||||
goto done;
|
||||
if (debug)
|
||||
clicon_option_dump(h, debug);
|
||||
if (dbg)
|
||||
clicon_option_dump(h, dbg);
|
||||
/* Depending on configure setting, privileges may be dropped here after
|
||||
* initializations */
|
||||
if (check_drop_priv(h, gid) < 0)
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ clixon_plugin_statedata_all(clicon_handle h,
|
|||
continue;
|
||||
}
|
||||
#if 1
|
||||
if (debug)
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, x, "%s STATE:", __FUNCTION__);
|
||||
#endif
|
||||
/* XXX: ret == 0 invalid yang binding should be handled as internal error */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue