From: David Goulet Date: Mon, 30 Jan 2012 16:40:45 +0000 (-0500) Subject: Improve lttng add-context message output X-Git-Tag: v2.0-pre19~38 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b58471ff5f24136bdad28f07c1c4be3e621d6064;p=lttng-tools.git Improve lttng add-context message output Signed-off-by: David Goulet --- diff --git a/src/bin/lttng/commands/add_context.c b/src/bin/lttng/commands/add_context.c index 6c374d17d..2f3bce1f5 100644 --- a/src/bin/lttng/commands/add_context.c +++ b/src/bin/lttng/commands/add_context.c @@ -405,14 +405,26 @@ static int add_context(char *session_name) ret = lttng_add_context(handle, &context, opt_event_name, opt_channel_name); if (ret < 0) { - ERR("%s: ", type->opt->symbol); + ERR("%s: %s", type->opt->symbol, lttng_strerror(ret)); warn = 1; continue; } else { - MSG("%s context %s added to %s event in %s", - opt_kernel ? "kernel" : "UST", type->opt->symbol, - opt_event_name ? opt_event_name : "all", - opt_channel_name ? opt_channel_name : "all channels"); + if (opt_channel_name && opt_event_name) { + MSG("%s context %s added to event %s channel %s", + opt_kernel ? "kernel" : "UST", type->opt->symbol, + opt_channel_name, opt_event_name); + } else if (opt_channel_name && !opt_event_name) { + MSG("%s context %s added to channel %s", + opt_kernel ? "kernel" : "UST", type->opt->symbol, + opt_channel_name); + } else if (!opt_channel_name && opt_event_name) { + MSG("%s context %s added to event %s", + opt_kernel ? "kernel" : "UST", type->opt->symbol, + opt_event_name); + } else { + MSG("%s context %s added to all channels", + opt_kernel ? "kernel" : "UST", type->opt->symbol) + } } }