Debug log enabled for pvget/pvput utils, debug info on active broadcast addresses.

This commit is contained in:
Matej Sekoranja
2011-09-29 14:34:44 +02:00
parent a87a2219de
commit 17ca4f9894
3 changed files with 19 additions and 7 deletions

View File

@@ -3767,6 +3767,10 @@ TODO
broadcastAddresses = list;
}
}
for (size_t i = 0; broadcastAddresses.get() && i < broadcastAddresses->size(); i++)
LOG(logLevelDebug,
"Broadcast address #%d: %s", i, inetAddressToString(broadcastAddresses->at(i)).c_str());
// where to bind (listen) address
osiSockAddr listenLocalAddress;

View File

@@ -346,7 +346,8 @@ void usage (void)
"options:\n"
" -r <pv request>: Request, specifies what fields to return and options, default is '%s'\n"
" -w <sec>: Wait time, specifies timeout, default is %f second(s)\n"
" -t: Terse mode - print only value, without name"
" -t: Terse mode - print only value, without name\n"
" -d: Enable debug output"
"\nExample: pvget example001 \n\n"
, DEFAULT_REQUEST, DEFAULT_TIMEOUT);
}
@@ -503,10 +504,11 @@ public:
int main (int argc, char *argv[])
{
int opt; /* getopt() current option */
bool debug = false;
setvbuf(stdout,NULL,_IOLBF,BUFSIZ); /* Set stdout to line buffering */
while ((opt = getopt(argc, argv, ":hr:w:t")) != -1) {
while ((opt = getopt(argc, argv, ":hr:w:td")) != -1) {
switch (opt) {
case 'h': /* Print usage */
usage();
@@ -525,6 +527,9 @@ int main (int argc, char *argv[])
case 't': /* Terse mode */
terseMode = true;
break;
case 'd': /* Debug log level */
debug = true;
break;
case '?':
fprintf(stderr,
"Unrecognized option: '-%c'. ('pvget -h' for help.)\n",
@@ -559,8 +564,7 @@ int main (int argc, char *argv[])
return 1;
}
// typedef enum {logLevelInfo, logLevelDebug, logLevelError, errlogFatal} errlogSevEnum;
SET_LOG_LEVEL(logLevelError);
SET_LOG_LEVEL(debug ? logLevelDebug : logLevelError);
ClientFactory::start();

View File

@@ -348,7 +348,8 @@ void usage (void)
"options:\n"
" -r <pv request>: Request, specifies what fields to return and options, default is '%s'\n"
" -w <sec>: Wait time, specifies timeout, default is %f second(s)\n"
" -t: Terse mode - print only value, without name"
" -t: Terse mode - print only value, without name\n"
" -d: Enable debug output"
"\nExample: pvput example001 1.234 10 test\n\n"
, DEFAULT_REQUEST, DEFAULT_TIMEOUT);
}
@@ -541,6 +542,7 @@ public:
int main (int argc, char *argv[])
{
int opt; /* getopt() current option */
bool debug = false;
setvbuf(stdout,NULL,_IOLBF,BUFSIZ); /* Set stdout to line buffering */
@@ -563,6 +565,9 @@ int main (int argc, char *argv[])
case 't': /* Terse mode */
terseMode = true;
break;
case 'd': /* Debug log level */
debug = true;
break;
case '?':
fprintf(stderr,
"Unrecognized option: '-%c'. ('pvput -h' for help.)\n",
@@ -605,8 +610,7 @@ int main (int argc, char *argv[])
return 1;
}
// typedef enum {logLevelInfo, logLevelDebug, logLevelError, errlogFatal} errlogSevEnum;
SET_LOG_LEVEL(logLevelError);
SET_LOG_LEVEL(debug ? logLevelDebug : logLevelError);
ClientFactory::start();