lib: strictly type function return status enumerations
[babeltrace.git] / src / cli / babeltrace2-cfg-cli-args.c
index e1470d7203cec0e00a001539b41fc42699215a01..3b76322f40c39f2d9a4b76500a09f368589a41dd 100644 (file)
@@ -58,6 +58,7 @@
        } while (0)
 
 static bool is_first_error = true;
+static const int cli_default_log_level = BT_LOG_WARN;
 
 /* INI-style parsing FSM states */
 enum ini_parsing_fsm_state {
@@ -268,7 +269,7 @@ bt_value *ini_parse_array(struct ini_parsing_state *state)
        while (!(token_type == G_TOKEN_CHAR && g_scanner_cur_value(state->scanner).v_char == ']')) {
                /* Parse the item... */
                bt_value *item_value;
-               bt_value_status status;
+               bt_value_array_append_element_status append_status;
 
                item_value = ini_parse_value(state);
                if (!item_value) {
@@ -276,10 +277,10 @@ bt_value *ini_parse_array(struct ini_parsing_state *state)
                }
 
                /* ... and add it to the result array. */
-               status = bt_value_array_append_element(array_value, item_value);
+               append_status = bt_value_array_append_element(array_value,
+                       item_value);
                BT_VALUE_PUT_REF_AND_RESET(item_value);
-
-               if (status != BT_VALUE_STATUS_OK) {
+               if (append_status < 0) {
                        goto error;
                }
 
@@ -878,7 +879,8 @@ end:
 static
 struct bt_config_component *bt_config_component_create(
                bt_component_class_type type,
-               const char *plugin_name, const char *comp_cls_name)
+               const char *plugin_name, const char *comp_cls_name,
+               int init_log_level)
 {
        struct bt_config_component *cfg_component = NULL;
 
@@ -909,6 +911,8 @@ struct bt_config_component *bt_config_component_create(
                goto error;
        }
 
+       cfg_component->log_level = init_log_level;
+
        /* Start with empty parameters */
        cfg_component->params = bt_value_map_create();
        if (!cfg_component->params) {
@@ -930,7 +934,8 @@ end:
  * option's argument.
  */
 static
-struct bt_config_component *bt_config_component_from_arg(const char *arg)
+struct bt_config_component *bt_config_component_from_arg(const char *arg,
+               int init_log_level)
 {
        struct bt_config_component *cfg_comp = NULL;
        char *name = NULL;
@@ -943,7 +948,8 @@ struct bt_config_component *bt_config_component_from_arg(const char *arg)
                goto error;
        }
 
-       cfg_comp = bt_config_component_create(type, plugin_name, comp_cls_name);
+       cfg_comp = bt_config_component_create(type, plugin_name, comp_cls_name,
+               init_log_level);
        if (!cfg_comp) {
                goto error;
        }
@@ -1422,6 +1428,7 @@ enum {
        OPT_HELP,
        OPT_INPUT_FORMAT,
        OPT_LIST,
+       OPT_LOG_LEVEL,
        OPT_NAME,
        OPT_NAMES,
        OPT_NO_DELTA,
@@ -1546,8 +1553,8 @@ int append_home_and_system_plugin_paths(bt_value *plugin_paths,
                if (bt_common_is_setuid_setgid()) {
                        BT_LOGI_STR("Skipping non-system plugin paths for setuid/setgid binary.");
                } else {
-                       char *home_plugin_dir =
-                               bt_common_get_home_plugin_path();
+                       char *home_plugin_dir = bt_common_get_home_plugin_path(
+                               BT_LOG_OUTPUT_LEVEL);
 
                        if (home_plugin_dir) {
                                ret = bt_config_append_plugin_paths(
@@ -1697,7 +1704,8 @@ end:
 
 static
 struct bt_config *bt_config_help_create(
-               const bt_value *initial_plugin_paths)
+               const bt_value *initial_plugin_paths,
+               int default_log_level)
 {
        struct bt_config *cfg;
 
@@ -1709,7 +1717,7 @@ struct bt_config *bt_config_help_create(
        }
 
        cfg->cmd_data.help.cfg_component =
-               bt_config_component_create(-1, NULL, NULL);
+               bt_config_component_create(-1, NULL, NULL, default_log_level);
        if (!cfg->cmd_data.help.cfg_component) {
                goto error;
        }
@@ -1926,7 +1934,7 @@ static
 struct bt_config *bt_config_help_from_args(int argc, const char *argv[],
                int *retcode, bool force_omit_system_plugin_path,
                bool force_omit_home_plugin_path,
-               const bt_value *initial_plugin_paths)
+               const bt_value *initial_plugin_paths, int default_log_level)
 {
        poptContext pc = NULL;
        char *arg = NULL;
@@ -1937,7 +1945,7 @@ struct bt_config *bt_config_help_from_args(int argc, const char *argv[],
        char *plugin_name = NULL, *comp_cls_name = NULL;
 
        *retcode = 0;
-       cfg = bt_config_help_create(initial_plugin_paths);
+       cfg = bt_config_help_create(initial_plugin_paths, default_log_level);
        if (!cfg) {
                goto error;
        }
@@ -2088,7 +2096,8 @@ static
 struct bt_config *bt_config_query_from_args(int argc, const char *argv[],
                int *retcode, bool force_omit_system_plugin_path,
                bool force_omit_home_plugin_path,
-               const bt_value *initial_plugin_paths)
+               const bt_value *initial_plugin_paths,
+               int default_log_level)
 {
        poptContext pc = NULL;
        char *arg = NULL;
@@ -2180,7 +2189,8 @@ struct bt_config *bt_config_query_from_args(int argc, const char *argv[],
        leftover = poptGetArg(pc);
        if (leftover) {
                cfg->cmd_data.query.cfg_component =
-                       bt_config_component_from_arg(leftover);
+                       bt_config_component_from_arg(leftover,
+                               default_log_level);
                if (!cfg->cmd_data.query.cfg_component) {
                        printf_err("Invalid format for component class specification:\n    %s\n",
                                leftover);
@@ -2397,6 +2407,8 @@ void print_run_usage(FILE *fp)
        fprintf(fp, "                                    specify the name with --name)\n");
        fprintf(fp, "  -x, --connect=CONNECTION          Connect two created components (see the\n");
        fprintf(fp, "                                    expected format of CONNECTION below)\n");
+       fprintf(fp, "  -l, --log-level=LVL               Set the log level of the current component to LVL\n");
+       fprintf(fp, "                                    (`N`, `V`, `D`, `I`, `W`, `E`, or `F`)\n");
        fprintf(fp, "  -n, --name=NAME                   Set the name of the current component\n");
        fprintf(fp, "                                    to NAME (must be unique amongst all the\n");
        fprintf(fp, "                                    names of the created components)\n");
@@ -2464,7 +2476,7 @@ static
 struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
                int *retcode, bool force_omit_system_plugin_path,
                bool force_omit_home_plugin_path,
-               const bt_value *initial_plugin_paths)
+               const bt_value *initial_plugin_paths, int default_log_level)
 {
        poptContext pc = NULL;
        char *arg = NULL;
@@ -2478,12 +2490,13 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
        bt_value *connection_args = NULL;
        char error_buf[256] = { 0 };
        long retry_duration = -1;
-       bt_value_status status;
+       bt_value_map_extend_status extend_status;
        struct poptOption run_long_options[] = {
                { "base-params", 'b', POPT_ARG_STRING, NULL, OPT_BASE_PARAMS, NULL, NULL },
                { "component", 'c', POPT_ARG_STRING, NULL, OPT_COMPONENT, NULL, NULL },
                { "connect", 'x', POPT_ARG_STRING, NULL, OPT_CONNECT, NULL, NULL },
                { "help", 'h', POPT_ARG_NONE, NULL, OPT_HELP, NULL, NULL },
+               { "log-level", 'l', POPT_ARG_STRING, NULL, OPT_LOG_LEVEL, NULL, NULL },
                { "name", 'n', POPT_ARG_STRING, NULL, OPT_NAME, NULL, NULL },
                { "omit-home-plugin-path", '\0', POPT_ARG_NONE, NULL, OPT_OMIT_HOME_PLUGIN_PATH, NULL, NULL },
                { "omit-system-plugin-path", '\0', POPT_ARG_NONE, NULL, OPT_OMIT_SYSTEM_PLUGIN_PATH, NULL, NULL },
@@ -2573,7 +2586,8 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
                                }
                        }
 
-                       cur_cfg_comp = bt_config_component_from_arg(arg);
+                       cur_cfg_comp = bt_config_component_from_arg(arg,
+                               default_log_level);
                        if (!cur_cfg_comp) {
                                printf_err("Invalid format for --component option's argument:\n    %s\n",
                                        arg);
@@ -2596,9 +2610,8 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
 
                        BT_ASSERT(cur_base_params);
                        bt_value_put_ref(cur_cfg_comp->params);
-                       status = bt_value_copy(cur_base_params,
-                               &cur_cfg_comp->params);
-                       if (status != BT_VALUE_STATUS_OK) {
+                       if (bt_value_copy(cur_base_params,
+                                       &cur_cfg_comp->params) < 0) {
                                print_err_oom();
                                goto error;
                        }
@@ -2624,10 +2637,10 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
                                goto error;
                        }
 
-                       status = bt_value_map_extend(cur_cfg_comp->params,
-                               params, &params_to_set);
+                       extend_status = bt_value_map_extend(
+                               cur_cfg_comp->params, params, &params_to_set);
                        BT_VALUE_PUT_REF_AND_RESET(params);
-                       if (status != BT_VALUE_STATUS_OK) {
+                       if (extend_status != BT_VALUE_MAP_EXTEND_STATUS_OK) {
                                printf_err("Cannot extend current component parameters with --params option's argument:\n    %s\n",
                                        arg);
                                goto error;
@@ -2645,6 +2658,21 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
 
                        g_string_assign(cur_cfg_comp->instance_name, arg);
                        break;
+               case OPT_LOG_LEVEL:
+                       if (!cur_cfg_comp) {
+                               printf_err("Cannot set the log level of unavailable component:\n    %s\n",
+                                       arg);
+                               goto error;
+                       }
+
+                       cur_cfg_comp->log_level =
+                               bt_log_get_level_from_string(arg);
+                       if (cur_cfg_comp->log_level < 0) {
+                               printf_err("Invalid argument for --log-level option:\n    %s\n",
+                                       arg);
+                               goto error;
+                       }
+                       break;
                case OPT_BASE_PARAMS:
                {
                        bt_value *params =
@@ -2767,7 +2795,7 @@ static
 struct bt_config *bt_config_run_from_args_array(const bt_value *run_args,
                int *retcode, bool force_omit_system_plugin_path,
                bool force_omit_home_plugin_path,
-               const bt_value *initial_plugin_paths)
+               const bt_value *initial_plugin_paths, int default_log_level)
 {
        struct bt_config *cfg = NULL;
        const char **argv;
@@ -2801,7 +2829,7 @@ struct bt_config *bt_config_run_from_args_array(const bt_value *run_args,
 
        cfg = bt_config_run_from_args(argc, argv, retcode,
                force_omit_system_plugin_path, force_omit_home_plugin_path,
-               initial_plugin_paths);
+               initial_plugin_paths, default_log_level);
 
 end:
        free(argv);
@@ -2825,6 +2853,8 @@ void print_convert_usage(FILE *fp)
        fprintf(fp, "                                    conversion graph, and optionally name it\n");
        fprintf(fp, "                                    NAME (you can also specify the name with\n");
        fprintf(fp, "                                    --name)\n");
+       fprintf(fp, "  -l, --log-level=LVL               Set the log level of the current component to LVL\n");
+       fprintf(fp, "                                    (`N`, `V`, `D`, `I`, `W`, `E`, or `F`)\n");
        fprintf(fp, "      --name=NAME                   Set the name of the current component\n");
        fprintf(fp, "                                    to NAME (must be unique amongst all the\n");
        fprintf(fp, "                                    names of the created components)\n");
@@ -2837,6 +2867,7 @@ void print_convert_usage(FILE *fp)
        fprintf(fp, "  -P, --path=PATH                   Set the `path` string parameter of the\n");
        fprintf(fp, "                                    current component to PATH\n");
        fprintf(fp, "      --plugin-path=PATH[:PATH]...  Add PATH to the list of paths from which\n");
+       fprintf(fp, "                                    dynamic plugins can be loaded\n");
        fprintf(fp, "      --retry-duration=DUR          When babeltrace2(1) needs to retry to run\n");
        fprintf(fp, "                                    the graph later, retry in DUR µs\n");
        fprintf(fp, "                                    (default: 100000)\n");
@@ -2965,6 +2996,7 @@ struct poptOption convert_long_options[] = {
        { "fields", 'f', POPT_ARG_STRING, NULL, OPT_FIELDS, NULL, NULL },
        { "help", 'h', POPT_ARG_NONE, NULL, OPT_HELP, NULL, NULL },
        { "input-format", 'i', POPT_ARG_STRING, NULL, OPT_INPUT_FORMAT, NULL, NULL },
+       { "log-level", 'l', POPT_ARG_STRING, NULL, OPT_LOG_LEVEL, NULL, NULL },
        { "name", '\0', POPT_ARG_STRING, NULL, OPT_NAME, NULL, NULL },
        { "names", 'n', POPT_ARG_STRING, NULL, OPT_NAMES, NULL, NULL },
        { "debug-info", '\0', POPT_ARG_NONE, NULL, OPT_DEBUG_INFO, NULL, NULL },
@@ -3715,7 +3747,7 @@ static
 struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                int *retcode, bool force_omit_system_plugin_path,
                bool force_omit_home_plugin_path,
-               const bt_value *initial_plugin_paths, char *log_level)
+               const bt_value *initial_plugin_paths, int *default_log_level)
 {
        poptContext pc = NULL;
        char *arg = NULL;
@@ -3994,6 +4026,24 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                        }
 
                        g_string_assign(cur_name, arg);
+                       break;
+               case OPT_LOG_LEVEL:
+                       if (cur_name_prefix->len == 0) {
+                               printf_err("No current component to assign a log level to:\n    %s\n",
+                                       arg);
+                               goto error;
+                       }
+
+                       if (bt_value_array_append_string_element(run_args, "--log-level")) {
+                               print_err_oom();
+                               goto error;
+                       }
+
+                       if (bt_value_array_append_string_element(run_args, arg)) {
+                               print_err_oom();
+                               goto error;
+                       }
+
                        break;
                case OPT_OMIT_HOME_PLUGIN_PATH:
                        force_omit_home_plugin_path = true;
@@ -4371,12 +4421,15 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                        stream_intersection_mode = true;
                        break;
                case OPT_VERBOSE:
-                       if (*log_level != 'V' && *log_level != 'D') {
-                               *log_level = 'I';
+                       if (*default_log_level != BT_LOG_TRACE &&
+                                       *default_log_level != BT_LOG_DEBUG) {
+                               *default_log_level = BT_LOG_INFO;
                        }
                        break;
                case OPT_DEBUG:
-                       *log_level = 'V';
+                       *default_log_level = BT_LOG_TRACE;
+                       break;
+               default:
                        break;
                }
 
@@ -4394,9 +4447,10 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
        /*
         * Legacy behaviour: --verbose used to make the `text` output
         * format print more information. --verbose is now equivalent to
-        * the INFO log level, which is why we compare to 'I' here.
+        * the INFO log level, which is why we compare to `BT_LOG_INFO`
+        * here.
         */
-       if (*log_level == 'I') {
+       if (*default_log_level == BT_LOG_INFO) {
                append_implicit_component_param(&implicit_text_args,
                        "verbose", "yes");
        }
@@ -4413,8 +4467,8 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
 
        /* Consume and keep leftover arguments */
        while ((leftover = poptGetArg(pc))) {
-               bt_value_status status = bt_value_array_append_string_element(leftovers, leftover);
-               if (status != BT_VALUE_STATUS_OK) {
+               if (bt_value_array_append_string_element(leftovers, leftover) !=
+                               BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_OK) {
                        print_err_oom();
                        goto error;
                }
@@ -4800,10 +4854,18 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                goto end;
        }
 
+       /*
+        * If the log level is still unset at this point, set it to
+        * the program's default.
+        */
+       if (*default_log_level < 0) {
+               *default_log_level = cli_default_log_level;
+       }
+
        cfg = bt_config_run_from_args_array(run_args, retcode,
-                                           force_omit_system_plugin_path,
-                                           force_omit_home_plugin_path,
-                                           initial_plugin_paths);
+               force_omit_system_plugin_path,
+               force_omit_home_plugin_path,
+               initial_plugin_paths, *default_log_level);
        if (!cfg) {
                goto error;
        }
@@ -4816,6 +4878,14 @@ error:
        BT_OBJECT_PUT_REF_AND_RESET(cfg);
 
 end:
+       /*
+        * If the log level is still unset at this point, set it to
+        * the program's default.
+        */
+       if (*default_log_level < 0) {
+               *default_log_level = cli_default_log_level;
+       }
+
        if (pc) {
                poptFreeContext(pc);
        }
@@ -4862,7 +4932,7 @@ void print_gen_usage(FILE *fp)
        fprintf(fp, "\n");
        fprintf(fp, "  -d, --debug          Enable debug mode (same as --log-level=V)\n");
        fprintf(fp, "  -h, --help           Show this help and quit\n");
-       fprintf(fp, "  -l, --log-level=LVL  Set all log levels to LVL (`N`, `V`, `D`,\n");
+       fprintf(fp, "  -l, --log-level=LVL  Set the default log level to LVL (`N`, `V`, `D`,\n");
        fprintf(fp, "                       `I`, `W` (default), `E`, or `F`)\n");
        fprintf(fp, "  -v, --verbose        Enable verbose mode (same as --log-level=I)\n");
        fprintf(fp, "  -V, --version        Show version and quit\n");
@@ -4878,38 +4948,6 @@ void print_gen_usage(FILE *fp)
        fprintf(fp, "Use `babeltrace2 COMMAND --help` to show the help of COMMAND.\n");
 }
 
-static
-char log_level_from_arg(const char *arg)
-{
-       char level = 'U';
-
-       if (strcmp(arg, "VERBOSE") == 0 ||
-                       strcmp(arg, "V") == 0) {
-               level = 'V';
-       } else if (strcmp(arg, "DEBUG") == 0 ||
-                       strcmp(arg, "D") == 0) {
-               level = 'D';
-       } else if (strcmp(arg, "INFO") == 0 ||
-                       strcmp(arg, "I") == 0) {
-               level = 'I';
-       } else if (strcmp(arg, "WARN") == 0 ||
-                       strcmp(arg, "WARNING") == 0 ||
-                       strcmp(arg, "W") == 0) {
-               level = 'W';
-       } else if (strcmp(arg, "ERROR") == 0 ||
-                       strcmp(arg, "E") == 0) {
-               level = 'E';
-       } else if (strcmp(arg, "FATAL") == 0 ||
-                       strcmp(arg, "F") == 0) {
-               level = 'F';
-       } else if (strcmp(arg, "NONE") == 0 ||
-                       strcmp(arg, "N") == 0) {
-               level = 'N';
-       }
-
-       return level;
-}
-
 struct bt_config *bt_config_cli_args_create(int argc, const char *argv[],
                int *retcode, bool force_omit_system_plugin_path,
                bool force_omit_home_plugin_path,
@@ -4920,7 +4958,7 @@ struct bt_config *bt_config_cli_args_create(int argc, const char *argv[],
        const char **command_argv = NULL;
        int command_argc = -1;
        const char *command_name = NULL;
-       char log_level = 'U';
+       int default_log_level = -1;
 
        enum command_type {
                COMMAND_TYPE_NONE = -1,
@@ -4956,18 +4994,19 @@ struct bt_config *bt_config_cli_args_create(int argc, const char *argv[],
 
                if (strcmp(cur_arg, "-d") == 0 ||
                                strcmp(cur_arg, "--debug") == 0) {
-                       log_level = 'V';
+                       default_log_level = BT_LOG_TRACE;
                } else if (strcmp(cur_arg, "-v") == 0 ||
                                strcmp(cur_arg, "--verbose") == 0) {
-                       if (log_level != 'V' && log_level != 'D') {
+                       if (default_log_level != BT_LOG_TRACE &&
+                                       default_log_level != BT_LOG_DEBUG) {
                                /*
                                 * Legacy: do not override a previous
                                 * --debug because --verbose and --debug
                                 * can be specified together (in this
                                 * case we want the lowest log level to
-                                * apply, VERBOSE).
+                                * apply, TRACE).
                                 */
-                               log_level = 'I';
+                               default_log_level = BT_LOG_INFO;
                        }
                } else if (strcmp(cur_arg, "--log-level") == 0 ||
                                strcmp(cur_arg, "-l") == 0) {
@@ -4977,8 +5016,9 @@ struct bt_config *bt_config_cli_args_create(int argc, const char *argv[],
                                goto end;
                        }
 
-                       log_level = log_level_from_arg(next_arg);
-                       if (log_level == 'U') {
+                       default_log_level =
+                               bt_log_get_level_from_string(next_arg);
+                       if (default_log_level < 0) {
                                printf_err("Invalid argument for --log-level option:\n    %s\n",
                                        next_arg);
                                *retcode = 1;
@@ -4989,8 +5029,8 @@ struct bt_config *bt_config_cli_args_create(int argc, const char *argv[],
                } else if (strncmp(cur_arg, "--log-level=", 12) == 0) {
                        const char *arg = &cur_arg[12];
 
-                       log_level = log_level_from_arg(arg);
-                       if (log_level == 'U') {
+                       default_log_level = bt_log_get_level_from_string(arg);
+                       if (default_log_level < 0) {
                                printf_err("Invalid argument for --log-level option:\n    %s\n",
                                        arg);
                                *retcode = 1;
@@ -4999,8 +5039,8 @@ struct bt_config *bt_config_cli_args_create(int argc, const char *argv[],
                } else if (strncmp(cur_arg, "-l", 2) == 0) {
                        const char *arg = &cur_arg[2];
 
-                       log_level = log_level_from_arg(arg);
-                       if (log_level == 'U') {
+                       default_log_level = bt_log_get_level_from_string(arg);
+                       if (default_log_level < 0) {
                                printf_err("Invalid argument for --log-level option:\n    %s\n",
                                        arg);
                                *retcode = 1;
@@ -5061,17 +5101,28 @@ struct bt_config *bt_config_cli_args_create(int argc, const char *argv[],
        BT_ASSERT(command_argv);
        BT_ASSERT(command_argc >= 0);
 
+       /*
+        * The convert command can set its own default log level for
+        * backward compatibility reasons. It only does so if there's no
+        * log level yet, so do not force one for this command.
+        */
+       if (command_type != COMMAND_TYPE_CONVERT && default_log_level < 0) {
+               /* Default log level */
+               default_log_level = cli_default_log_level;
+       }
+
        switch (command_type) {
        case COMMAND_TYPE_RUN:
                config = bt_config_run_from_args(command_argc, command_argv,
                        retcode, force_omit_system_plugin_path,
-                       force_omit_home_plugin_path, initial_plugin_paths);
+                       force_omit_home_plugin_path, initial_plugin_paths,
+                       default_log_level);
                break;
        case COMMAND_TYPE_CONVERT:
                config = bt_config_convert_from_args(command_argc, command_argv,
                        retcode, force_omit_system_plugin_path,
                        force_omit_home_plugin_path,
-                       initial_plugin_paths, &log_level);
+                       initial_plugin_paths, &default_log_level);
                break;
        case COMMAND_TYPE_LIST_PLUGINS:
                config = bt_config_list_plugins_from_args(command_argc,
@@ -5081,23 +5132,22 @@ struct bt_config *bt_config_cli_args_create(int argc, const char *argv[],
        case COMMAND_TYPE_HELP:
                config = bt_config_help_from_args(command_argc,
                        command_argv, retcode, force_omit_system_plugin_path,
-                       force_omit_home_plugin_path, initial_plugin_paths);
+                       force_omit_home_plugin_path, initial_plugin_paths,
+                       default_log_level);
                break;
        case COMMAND_TYPE_QUERY:
                config = bt_config_query_from_args(command_argc,
                        command_argv, retcode, force_omit_system_plugin_path,
-                       force_omit_home_plugin_path, initial_plugin_paths);
+                       force_omit_home_plugin_path, initial_plugin_paths,
+                       default_log_level);
                break;
        default:
                abort();
        }
 
        if (config) {
-               if (log_level == 'U') {
-                       log_level = 'W';
-               }
-
-               config->log_level = log_level;
+               BT_ASSERT(default_log_level >= BT_LOG_TRACE);
+               config->log_level = default_log_level;
                config->command_name = command_name;
        }
 
This page took 0.031966 seconds and 4 git commands to generate.