Improve lttng add-context message output
authorDavid Goulet <dgoulet@efficios.com>
Mon, 30 Jan 2012 16:40:45 +0000 (11:40 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Mon, 30 Jan 2012 16:40:45 +0000 (11:40 -0500)
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng/commands/add_context.c

index 6c374d17da93ffbd16174d88883f7dec7a35f908..2f3bce1f5bed2ccffc872a699f1cd8b8ac486e10 100644 (file)
@@ -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)
+                       }
                }
        }
 
This page took 0.027665 seconds and 5 git commands to generate.