[Aggregator] Switch verbose mode to verbose level

The verbose option is now an integer value instead of a boolean, to
allow several levels of verbosity.
This commit is contained in:
Matteo Cypriani 2011-07-23 21:37:02 +02:00
parent 21a82b83d0
commit 6536805578
1 changed files with 8 additions and 6 deletions

View File

@ -169,8 +169,8 @@ void parse_config_file(int argc, char **argv)
// Config file options for confuse
cfg_opt_t opts[] =
{
// Be verbose?
CFG_BOOL("verbose", cfg_false, CFGF_NONE),
// Verbose level
CFG_INT("verbose", 0, CFGF_NONE),
// Aggregation listening port
CFG_INT("listening_port", AGGREGATE_DEFAULT_PORT, CFGF_NONE),
@ -301,7 +301,9 @@ void parse_command_line(int argc, char **argv)
cfg_setint(cfg, "aggregate_timeout", strtol(optarg, NULL, 0)) ;
break ;
case 'v' :
cfg_setbool(cfg, "verbose", cfg_true) ;
// Increment the verbose level
cfg_setint(cfg, "verbose",
cfg_getint(cfg, "verbose") + 1) ;
break ;
default :
print_usage() ;
@ -443,7 +445,7 @@ int read_loop(int sockfd)
request.y_position = owl_ntohf(request.y_position) ;
request.z_position = owl_ntohf(request.z_position) ;
if (cfg_getbool(cfg, "verbose"))
if (cfg_getint(cfg, "verbose"))
{
inet_ntop(AF_INET, &request.mobile_ip_addr_bytes,
mobile_ip_str, INET_ADDRSTRLEN) ;
@ -1291,8 +1293,8 @@ void print_usage()
"\t-V\t\tShow version information.\n"
"\t-f config_file\tUse 'config_file' instead of the default"
" configuration file (%s).\n"
"\t-v\t\tBe verbose (print detailed info on each received"
" message).\n"
"\t-v\t\tBe verbose (you can use this option several times to"
" increase the level of verbosity).\n"
"Output options:\n"
"\t-o output_file\t\tAggregated requests will be appended to"