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)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 18 Jul 2019 05:26:22 +0000 (01:26 -0400)
commit9f90145146cee221f46087a8dd250c1c0f14c9c0
tree1847df0954c4b5f1cba7a123d7496623fb568d6b
parent800400d86c6da90a922580a28602c0c795ac2d68
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.024906 seconds and 4 git commands to generate.