[Aggregator] Limit the verbose level to a maximum

For now the maximum verbose level is 4, so it is best for the user to
avoid displaying a verbose level higher than that in the configuration.
This commit is contained in:
Matteo Cypriani 2013-10-04 10:44:40 -04:00
parent f08097ea08
commit 56edcc623a
3 changed files with 6 additions and 5 deletions

View File

@ -81,8 +81,6 @@ Work to do in OwlPS
- Option to overwrite the output file (ask for a confirmation!). - Option to overwrite the output file (ask for a confirmation!).
- Test for the maximum verbose level.
- Outputs should include all the timestamps - Outputs should include all the timestamps
The CSV output file and the socket should include the capture The CSV output file and the socket should include the capture

View File

@ -43,6 +43,7 @@
#define VERBOSE_INFO cfg_getint(cfg, "verbose") >= 2 #define VERBOSE_INFO cfg_getint(cfg, "verbose") >= 2
#define VERBOSE_CHATTERBOX cfg_getint(cfg, "verbose") >= 3 #define VERBOSE_CHATTERBOX cfg_getint(cfg, "verbose") >= 3
#define VERBOSE_REQUESTS cfg_getint(cfg, "verbose") >= 4 #define VERBOSE_REQUESTS cfg_getint(cfg, "verbose") >= 4
#define MAX_VERBOSE_LEVEL 4
/* Linked list storing data of each request */ /* Linked list storing data of each request */

View File

@ -453,9 +453,11 @@ int parse_command_line(const int argc, char *const *argv)
" failing back to the default value.\n") ; " failing back to the default value.\n") ;
break ; break ;
case 'v' : case 'v' :
// Increment the verbose level { // Increment the verbose level if the maximum is not reached
cfg_setint(cfg, "verbose", long vlevel = cfg_getint(cfg, "verbose") ;
cfg_getint(cfg, "verbose") + 1) ; if (vlevel < MAX_VERBOSE_LEVEL)
cfg_setint(cfg, "verbose", vlevel + 1) ;
}
break ; break ;
default : default :
print_usage() ; print_usage() ;