X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fadd_context.c;h=2f3bce1f5bed2ccffc872a699f1cd8b8ac486e10;hb=b58471ff5f24136bdad28f07c1c4be3e621d6064;hp=6c374d17da93ffbd16174d88883f7dec7a35f908;hpb=9197c5c48e2d1db4c2f9318bbf0af0af9918fdc8;p=lttng-tools.git 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) + } } }