From 52ffe35392be0f1c9a7674aa7db9f925164268a9 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 25 Feb 2020 16:02:57 -0500 Subject: [PATCH] Fix: cli: use BT_CLI_LOGE_APPEND_CAUSE instead of printf to print errors While fixing up the test cli/convert/test_convert_args, I noticed that some error messages were printed on stdout, and not using error causes. Indeed, they are printed directly using printf. Change them to use BT_CLI_LOGE_APPEND_CAUSE. This is tested by a following patch which updates cli/convert/test_convert_args. Change-Id: I18a901d50b643293dd806c1fbe7d2372dc8bd46f Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/3146 Tested-by: jenkins --- src/cli/babeltrace2-cfg-cli-args.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cli/babeltrace2-cfg-cli-args.c b/src/cli/babeltrace2-cfg-cli-args.c index 38a66502..6ba6808b 100644 --- a/src/cli/babeltrace2-cfg-cli-args.c +++ b/src/cli/babeltrace2-cfg-cli-args.c @@ -3643,7 +3643,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[], switch (argpar_item_opt->descr->id) { case OPT_BEGIN: if (trimmer_has_begin) { - printf("At --begin option: --begin or --timerange option already specified\n %s\n", + BT_CLI_LOGE_APPEND_CAUSE("At --begin option: --begin or --timerange option already specified\n %s\n", arg); goto error; } @@ -3658,7 +3658,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[], break; case OPT_END: if (trimmer_has_end) { - printf("At --end option: --end or --timerange option already specified\n %s\n", + BT_CLI_LOGE_APPEND_CAUSE("At --end option: --end or --timerange option already specified\n %s\n", arg); goto error; } @@ -3677,7 +3677,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[], char *end; if (trimmer_has_begin || trimmer_has_end) { - printf("At --timerange option: --begin, --end, or --timerange option already specified\n %s\n", + BT_CLI_LOGE_APPEND_CAUSE("At --timerange option: --begin, --end, or --timerange option already specified\n %s\n", arg); goto error; } -- 2.34.1