CLI: show agent event filter string
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 26 Feb 2016 20:13:33 +0000 (15:13 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 3 Mar 2016 22:19:41 +0000 (17:19 -0500)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng/commands/list.c

index 1b89ef642f797f92d7fbc758a4f3fcb0768fd5e6..efba35e865a60162f08a8591ce938cc44591381d 100644 (file)
@@ -1002,21 +1002,42 @@ static int list_session_agent_events(void)
                }
 
                for (i = 0; i < count; i++) {
-                       if (events[i].loglevel_type !=
+                       const char *filter_str;
+                       char *filter_msg = NULL;
+                       struct lttng_event *event = &events[i];
+
+                       ret = lttng_event_get_filter_string(event, &filter_str);
+                       if (ret) {
+                               filter_msg = strdup(" [failed to retrieve filter]");
+                       } else if (filter_str) {
+                               const char * const filter_fmt =
+                                               " [filter: '%s']";
+
+                               filter_msg = malloc(strlen(filter_str) +
+                                               strlen(filter_fmt) + 1);
+                               if (filter_msg) {
+                                       sprintf(filter_msg, " [filter: '%s']",
+                                               filter_str);
+                               }
+                       }
+
+                       if (event->loglevel_type !=
                                        LTTNG_EVENT_LOGLEVEL_ALL) {
-                               MSG("%s- %s%s (loglevel%s %s)", indent4,
-                                               events[i].name,
-                                               enabled_string(
-                                                       events[i].enabled),
+                               MSG("%s- %s%s (loglevel%s %s)%s", indent4,
+                                               event->name,
+                                               enabled_string(event->enabled),
                                                logleveltype_string(
-                                                       events[i].loglevel_type),
+                                                       event->loglevel_type),
                                                mi_lttng_loglevel_string(
-                                                       events[i].loglevel,
-                                                       handle->domain.type));
+                                                       event->loglevel,
+                                                       handle->domain.type),
+                                               filter_message(filter_msg));
                        } else {
-                               MSG("%s- %s%s", indent4, events[i].name,
-                                   enabled_string(events[i].enabled));
+                               MSG("%s- %s%s%s", indent4, event->name,
+                                               enabled_string(event->enabled),
+                                               filter_message(filter_msg));
                        }
+                       free(filter_msg);
                }
 
                MSG("");
This page took 0.027747 seconds and 4 git commands to generate.