Cleanup list command printout for loglevel
[lttng-tools.git] / src / bin / lttng / commands / list.c
index f915a16855f2dccbe2d924344febf77f74bda747..e4ab97cbe920c67c385e30fceccb8a68a271a145 100644 (file)
@@ -196,11 +196,10 @@ static void print_events(struct lttng_event *event)
        switch (event->type) {
        case LTTNG_EVENT_TRACEPOINT:
        {
-               MSG("%s%s%s%s%d%s (type: tracepoint)%s", indent6,
+               MSG("%s%s%s%s%s (type: tracepoint)%s", indent6,
                                event->name,
                                loglevel_string_pre(event->loglevel),
                                loglevel_string(event->loglevel),
-                               event->loglevel,
                                loglevel_string_post(event->loglevel),
                                enabled_string(event->enabled));
                break;
@@ -480,7 +479,8 @@ static int list_sessions(const char *session_name)
                        continue;
                }
 
-               MSG("  %d) %s (%s)%s", i + 1, sessions[i].name, sessions[i].path, active_string(sessions[i].enabled));
+               MSG("  %d) %s (%s)%s", i + 1, sessions[i].name, sessions[i].path,
+                               active_string(sessions[i].enabled));
 
                if (session_found) {
                        break;
@@ -490,7 +490,9 @@ static int list_sessions(const char *session_name)
        free(sessions);
 
        if (!session_found && session_name != NULL) {
-               ERR("Session %s not found", session_name);
+               ERR("Session '%s' not found", session_name);
+               ret = CMD_ERROR;
+               goto error;
        }
 
        if (session_name == NULL) {
@@ -601,39 +603,32 @@ int cmd_list(int argc, const char **argv)
        if (session_name == NULL) {
                if (!opt_kernel && !opt_userspace) {
                        ret = list_sessions(NULL);
-                       if (ret < 0) {
-                               ret = CMD_ERROR;
+                       if (ret != 0) {
                                goto end;
                        }
                }
                if (opt_kernel) {
                        ret = list_kernel_events();
                        if (ret < 0) {
-                               ret = CMD_ERROR;
                                goto end;
                        }
                }
                if (opt_userspace) {
                        ret = list_ust_events();
                        if (ret < 0) {
-                               ret = CMD_ERROR;
                                goto end;
                        }
                }
        } else {
                /* List session attributes */
                ret = list_sessions(session_name);
-               if (ret < 0) {
-                       ret = CMD_ERROR;
+               if (ret != 0) {
                        goto end;
                }
 
                /* Domain listing */
                if (opt_domain) {
                        ret = list_domains(session_name);
-                       if (ret < 0) {
-                               ret = CMD_ERROR;
-                       }
                        goto end;
                }
 
@@ -641,14 +636,13 @@ int cmd_list(int argc, const char **argv)
                        /* Channel listing */
                        ret = list_channels(opt_channel);
                        if (ret < 0) {
-                               ret = CMD_ERROR;
                                goto end;
                        }
                } else {
                        /* We want all domain(s) */
                        nb_domain = lttng_list_domains(session_name, &domains);
                        if (nb_domain < 0) {
-                               ret = CMD_ERROR;
+                               ret = nb_domain;
                                goto end;
                        }
 
@@ -676,7 +670,6 @@ int cmd_list(int argc, const char **argv)
 
                                ret = list_channels(opt_channel);
                                if (ret < 0) {
-                                       ret = CMD_ERROR;
                                        goto end;
                                }
                        }
This page took 0.02473 seconds and 4 git commands to generate.