]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[fs_cli] Add: -s key adding log events filter UUID on fs_cli startup
authorKonstantin S. Vishnivetsky <kvishnivetsky@users.noreply.github.com>
Thu, 6 Oct 2022 09:12:05 +0000 (13:12 +0400)
committerGitHub <noreply@github.com>
Thu, 6 Oct 2022 09:12:05 +0000 (12:12 +0300)
* Add: -s key adding log events filter UUID on fs_cli startup
* Add: long option --set-log-uuid

libs/esl/fs_cli.c

index 76e85b450d52993a91a926965c0f123fe5a5dcb0..973df741e023c3b5aedf0a62baa18fea1cc6c537 100644 (file)
@@ -632,7 +632,8 @@ static const char *usage_str =
        "  -b, --batchmode                 Batch mode\n"
        "  -t, --timeout                   Timeout for API commands (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){
        printf(usage_str, name);
@@ -1468,6 +1469,7 @@ int main(int argc, char *argv[])
                {"reconnect", 0, 0, 'R'},
                {"timeout", 1, 0, 't'},
                {"connect-timeout", 1, 0, 'T'},
+               {"set-log-uuid", 1, 0, 's'},
                {0, 0, 0, 0}
        };
        char temp_host[128];
@@ -1483,6 +1485,7 @@ int main(int argc, char *argv[])
        int argv_exec = 0;
        char argv_command[1024] = "";
        char argv_loglevel[127] = "";
+       char argv_filter_uuid[64] = {0};
        int argv_log_uuid = 0;
        int argv_log_uuid_short = 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) */
        for(;;) {
                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;
                switch (opt) {
                        case 'H':
@@ -1614,6 +1617,11 @@ int main(int argc, char *argv[])
                        case 'T':
                                connect_timeout = atoi(optarg);
                                break;
+                       case 's':
+                               esl_set_string(argv_filter_uuid, optarg);
+                               filter_uuid = strdup(argv_filter_uuid);
+                               break;
+
                        case 'h':
                        case '?':
                                print_banner(stdout, is_color);