from subprocess import Popen, PIPE
from difflib import Differ
-DEBUG = False
+DEBUG = 0
VERBOSE = False
for tclist in tests:
for tc in tclist:
args = [cmd]
+ if DEBUG > 1:
+ args.append('-d')
for pd in tc['pdlist']:
args.extend(['-P', pd['name']])
for label, probe in pd['probes']:
opts, args = getopt(sys.argv[1:], "dvarslRS:")
for opt, arg in opts:
if opt == '-d':
- DEBUG = True
+ DEBUG += 1
if opt == '-v':
VERBOSE = True
elif opt == '-a':
va_end(args);
}
+int sr_log(void *cb_data, int loglevel, const char *format, va_list args)
+{
+ (void)cb_data;
+
+ if (loglevel == SR_LOG_ERR || loglevel == SR_LOG_WARN)
+ logmsg("Error: sr: ", stderr, format, args);
+ else if (debug)
+ logmsg("DBG: sr: ", stdout, format, args);
+
+ return SRD_OK;
+}
+
int srd_log(void *cb_data, int loglevel, const char *format, va_list args)
{
(void)cb_data;
if (loglevel == SRD_LOG_ERR || loglevel == SRD_LOG_WARN)
logmsg("Error: srd: ", stderr, format, args);
- else if (loglevel >= SRD_LOG_DBG && debug)
+ else if (debug)
logmsg("DBG: srd: ", stdout, format, args);
return SRD_OK;
if (!op->pd || op->type == -1)
usage(NULL);
+ sr_log_callback_set(sr_log, NULL);
if (sr_init(&ctx) != SR_OK)
return 1;