cli: Replace printf_err with BT_CLI_LOGE_APPEND_CAUSE
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 11 Jul 2019 19:38:18 +0000 (15:38 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 18 Jul 2019 15:53:35 +0000 (11:53 -0400)
commit4b39e5c9044919bf725a580fad7c44c08f8bbfb8
tree25cb2fc5869d5bbe64bf15606be3192ddf81bd75
parent9b59650db1f72607706b8eb08aaf1cb123f15e79
cli: Replace printf_err with BT_CLI_LOGE_APPEND_CAUSE

The printf_err macro is currently used to report an error in the CLI.
However, we now have a proper error reporting framework.  This patches
makes the CLI use it.

All usages of printf_err are replaced with BT_CLI_LOGE_APPEND_CAUSE.

All usages of print_err_oom are replaced with a new macro that calls
BT_CLI_LOGE_APPEND_CAUSE("Out of memory.").

I haven't tested all the errors paths to make sure they worked well, but
here are some examples of the result:

    $ babeltrace2 convert --run-args --legault

    ERROR:    [Babeltrace CLI] (/home/smarchi/src/babeltrace/src/cli/babeltrace2.c:2874)
      Command-line error: retcode=1
    CAUSED BY [Babeltrace CLI] (/home/smarchi/src/babeltrace/src/cli/babeltrace2-cfg-cli-args.c:3621)
      While parsing command-line options, at option --legault: unknown option

    $ babeltrace2 convert --run-args -i salut

    ERROR:    [Babeltrace CLI] (/home/smarchi/src/babeltrace/src/cli/babeltrace2.c:2874)
      Command-line error: retcode=1
    CAUSED BY [Babeltrace CLI] (/home/smarchi/src/babeltrace/src/cli/babeltrace2-cfg-cli-args.c:3834)
      Unknown legacy input format:
          salut

Change-Id: I891c0518c66f61a62fd2e73cf3c438b622aabd9a
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1692
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
src/cli/babeltrace2-cfg-cli-args.c
This page took 0.025528 seconds and 4 git commands to generate.