[fs_cli] Add: -s key adding log events filter UUID on fs_cli startup

* Add: -s key adding log events filter UUID on fs_cli startup
* Add: long option --set-log-uuid
This commit is contained in:
Konstantin S. Vishnivetsky 2022-10-06 13:12:05 +04:00 committed by GitHub
parent c71ed98add
commit 9c7c77e259
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -632,7 +632,8 @@ static const char *usage_str =
" -b, --batchmode Batch mode\n" " -b, --batchmode Batch mode\n"
" -t, --timeout Timeout for API commands (in milliseconds)\n" " -t, --timeout Timeout for API commands (in milliseconds)\n"
" -T, --connect-timeout Timeout for socket connection (in milliseconds)\n" " -T, --connect-timeout Timeout for socket connection (in milliseconds)\n"
" -n, --no-color Disable color\n\n"; " -n, --no-color Disable color\n"
" -s, --set-log-uuid Set UUID to filter log events\n\n";
static int usage(char *name){ static int usage(char *name){
printf(usage_str, name); printf(usage_str, name);
@ -1468,6 +1469,7 @@ int main(int argc, char *argv[])
{"reconnect", 0, 0, 'R'}, {"reconnect", 0, 0, 'R'},
{"timeout", 1, 0, 't'}, {"timeout", 1, 0, 't'},
{"connect-timeout", 1, 0, 'T'}, {"connect-timeout", 1, 0, 'T'},
{"set-log-uuid", 1, 0, 's'},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
char temp_host[128]; char temp_host[128];
@ -1483,6 +1485,7 @@ int main(int argc, char *argv[])
int argv_exec = 0; int argv_exec = 0;
char argv_command[1024] = ""; char argv_command[1024] = "";
char argv_loglevel[127] = ""; char argv_loglevel[127] = "";
char argv_filter_uuid[64] = {0};
int argv_log_uuid = 0; int argv_log_uuid = 0;
int argv_log_uuid_short = 0; int argv_log_uuid_short = 0;
int argv_quiet = 0; int argv_quiet = 0;
@ -1539,7 +1542,7 @@ int main(int argc, char *argv[])
esl_global_set_default_logger(6); /* default debug level to 6 (info) */ esl_global_set_default_logger(6); /* default debug level to 6 (info) */
for(;;) { for(;;) {
int option_index = 0; int option_index = 0;
opt = getopt_long(argc, argv, "H:P:u:p:d:x:l:USt:T:qQrRhib?n", options, &option_index); opt = getopt_long(argc, argv, "H:P:u:p:d:x:l:USt:T:qQrRhib?ns:", options, &option_index);
if (opt == -1) break; if (opt == -1) break;
switch (opt) { switch (opt) {
case 'H': case 'H':
@ -1614,6 +1617,11 @@ int main(int argc, char *argv[])
case 'T': case 'T':
connect_timeout = atoi(optarg); connect_timeout = atoi(optarg);
break; break;
case 's':
esl_set_string(argv_filter_uuid, optarg);
filter_uuid = strdup(argv_filter_uuid);
break;
case 'h': case 'h':
case '?': case '?':
print_banner(stdout, is_color); print_banner(stdout, is_color);