X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=cli%2Fbabeltrace.c;h=fbf611417130c5c47c49879ce1764b278b7925ef;hb=50ad9320ef034cba9c1b997d57c69e09f1152d87;hp=3d37d4e01010d941def39933ab403f28aa1ff7eb;hpb=0fbb9a9fffe22e0d5211a47118102fa0ba4a766a;p=babeltrace.git diff --git a/cli/babeltrace.c b/cli/babeltrace.c index 3d37d4e0..fbf61141 100644 --- a/cli/babeltrace.c +++ b/cli/babeltrace.c @@ -581,6 +581,19 @@ int load_dynamic_plugins(struct bt_value *plugin_paths) plugin_path_value = bt_value_array_get(plugin_paths, i); bt_value_string_get(plugin_path_value, &plugin_path); assert(plugin_path); + + /* + * Skip this if the directory does not exist because + * bt_plugin_create_all_from_dir() expects an existing + * directory. + */ + if (!g_file_test(plugin_path, G_FILE_TEST_IS_DIR)) { + BT_LOGV("Skipping nonexistent directory path: " + "path=\"%s\"", plugin_path); + BT_PUT(plugin_path_value); + continue; + } + plugin_set = bt_plugin_create_all_from_dir(plugin_path, false); if (!plugin_set) { BT_LOGD("Unable to load dynamic plugins: path=\"%s\"", @@ -1494,25 +1507,29 @@ int cmd_run_ctx_init(struct cmd_run_ctx *ctx, struct bt_config *cfg) the_graph = ctx->graph; ret = bt_graph_add_port_added_listener(ctx->graph, graph_port_added_listener, ctx); - if (ret) { + if (ret < 0) { + BT_LOGE_STR("Cannot add \"port added\" listener to graph."); goto error; } ret = bt_graph_add_port_removed_listener(ctx->graph, graph_port_removed_listener, ctx); - if (ret) { + if (ret < 0) { + BT_LOGE_STR("Cannot add \"port removed\" listener to graph."); goto error; } ret = bt_graph_add_ports_connected_listener(ctx->graph, graph_ports_connected_listener, ctx); - if (ret) { + if (ret < 0) { + BT_LOGE_STR("Cannot add \"ports connected\" listener to graph."); goto error; } ret = bt_graph_add_ports_disconnected_listener(ctx->graph, graph_ports_disconnected_listener, ctx); - if (ret) { + if (ret < 0) { + BT_LOGE_STR("Cannot add \"ports disconnected\" listener to graph."); goto error; } @@ -1732,6 +1749,13 @@ int cmd_run(struct bt_config *cfg) goto error; } + if (canceled) { + BT_LOGI_STR("Canceled by user before creating components."); + goto error; + } + + BT_LOGI_STR("Creating components."); + /* Create the requested component instances */ if (cmd_run_ctx_create_components(&ctx)) { BT_LOGE_STR("Cannot create components."); @@ -1739,6 +1763,13 @@ int cmd_run(struct bt_config *cfg) goto error; } + if (canceled) { + BT_LOGI_STR("Canceled by user before connecting components."); + goto error; + } + + BT_LOGI_STR("Connecting components."); + /* Connect the initially visible component ports */ if (cmd_run_ctx_connect_ports(&ctx)) { BT_LOGE_STR("Cannot connect initial component ports."); @@ -1747,7 +1778,8 @@ int cmd_run(struct bt_config *cfg) } if (canceled) { - goto end; + BT_LOGI_STR("Canceled by user before running the graph."); + goto error; } BT_LOGI_STR("Running the graph."); @@ -1841,31 +1873,7 @@ void warn_command_name_and_directory_clash(struct bt_config *cfg) static void init_log_level(void) { - enum bt_logging_level log_level = BT_LOG_NONE; - const char *log_level_env = getenv("BABELTRACE_CLI_LOG_LEVEL"); - - if (!log_level_env) { - goto set_level; - } - - if (strcmp(log_level_env, "VERBOSE") == 0) { - log_level = BT_LOGGING_LEVEL_VERBOSE; - } else if (strcmp(log_level_env, "DEBUG") == 0) { - log_level = BT_LOGGING_LEVEL_DEBUG; - } else if (strcmp(log_level_env, "INFO") == 0) { - log_level = BT_LOGGING_LEVEL_INFO; - } else if (strcmp(log_level_env, "WARN") == 0) { - log_level = BT_LOGGING_LEVEL_WARN; - } else if (strcmp(log_level_env, "ERROR") == 0) { - log_level = BT_LOGGING_LEVEL_ERROR; - } else if (strcmp(log_level_env, "FATAL") == 0) { - log_level = BT_LOGGING_LEVEL_FATAL; - } else if (strcmp(log_level_env, "NONE") == 0) { - log_level = BT_LOGGING_LEVEL_NONE; - } - -set_level: - bt_cli_log_level = log_level; + bt_cli_log_level = bt_log_get_level_from_env("BABELTRACE_CLI_LOG_LEVEL"); } void set_sigint_handler(void)