Cleanup: cli: move LOGE statements closer to the source
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Mon, 4 Nov 2019 19:55:11 +0000 (14:55 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 14 Nov 2019 22:49:46 +0000 (17:49 -0500)
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I752ff78e043e4948489360c5b4e4206a5350c9fd
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2329
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
src/cli/babeltrace2.c

index bb0411a65fe8f174912ce86003998de9dfe67ae3..29bd95a9bfa67bf832302839aff635513fb3f0c7 100644 (file)
@@ -717,22 +717,21 @@ enum bt_cmd_status cmd_query(struct bt_config *cfg)
                cfg->cmd_data.query.cfg_component->params,
                &results, &fail_reason);
        if (ret) {
-               goto failed;
+               BT_CLI_LOGE_APPEND_CAUSE(
+                       "Failed to query component class: %s: plugin-name=\"%s\", "
+                       "comp-cls-name=\"%s\", comp-cls-type=%d "
+                       "object=\"%s\"", fail_reason,
+                       cfg->cmd_data.query.cfg_component->plugin_name->str,
+                       cfg->cmd_data.query.cfg_component->comp_cls_name->str,
+                       cfg->cmd_data.query.cfg_component->type,
+                       cfg->cmd_data.query.object->str);
+               goto error;
        }
 
        print_value(stdout, results, 0);
        cmd_status = BT_CMD_STATUS_OK;
        goto end;
 
-failed:
-       BT_CLI_LOGE_APPEND_CAUSE(
-               "Failed to query component class: %s: plugin-name=\"%s\", "
-               "comp-cls-name=\"%s\", comp-cls-type=%d "
-               "object=\"%s\"", fail_reason,
-               cfg->cmd_data.query.cfg_component->plugin_name->str,
-               cfg->cmd_data.query.cfg_component->comp_cls_name->str,
-               cfg->cmd_data.query.cfg_component->type,
-               cfg->cmd_data.query.object->str);
 error:
        cmd_status = BT_CMD_STATUS_ERROR;
 
@@ -988,7 +987,9 @@ enum bt_cmd_status cmd_print_lttng_live_sessions(struct bt_config *cfg)
        ret = query(cfg, comp_cls, "sessions", params,
                    &results, &fail_reason);
        if (ret) {
-               goto failed;
+               BT_CLI_LOGE_APPEND_CAUSE("Failed to query `sessions` object: %s",
+                       fail_reason);
+               goto error;
        }
 
        BT_ASSERT(results);
@@ -1061,10 +1062,6 @@ enum bt_cmd_status cmd_print_lttng_live_sessions(struct bt_config *cfg)
        cmd_status = BT_CMD_STATUS_OK;
        goto end;
 
-failed:
-       BT_CLI_LOGE_APPEND_CAUSE("Failed to query `sessions` object: %s",
-               fail_reason);
-
 error:
        cmd_status = BT_CMD_STATUS_ERROR;
 
@@ -1129,7 +1126,9 @@ enum bt_cmd_status cmd_print_ctf_metadata(struct bt_config *cfg)
        ret = query(cfg, comp_cls, "metadata-info",
                params, &results, &fail_reason);
        if (ret) {
-               goto failed;
+               BT_CLI_LOGE_APPEND_CAUSE(
+                       "Failed to query `metadata-info` object: %s", fail_reason);
+               goto error;
        }
 
        metadata_text_value = bt_value_map_borrow_entry_value_const(results,
@@ -1169,9 +1168,6 @@ enum bt_cmd_status cmd_print_ctf_metadata(struct bt_config *cfg)
        cmd_status = BT_CMD_STATUS_OK;
        goto end;
 
-failed:
-       BT_CLI_LOGE_APPEND_CAUSE(
-               "Failed to query `metadata-info` object: %s", fail_reason);
 error:
        cmd_status = BT_CMD_STATUS_ERROR;
 
This page took 0.029007 seconds and 4 git commands to generate.