From: Jérémie Galarneau Date: Fri, 26 Feb 2016 20:13:33 +0000 (-0500) Subject: CLI: show agent event filter string X-Git-Tag: v2.8.0-rc1~140 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=9a890ce83979d66624ba28c6c3dc3d2f00b066a4 CLI: show agent event filter string Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c index 1b89ef642..efba35e86 100644 --- a/src/bin/lttng/commands/list.c +++ b/src/bin/lttng/commands/list.c @@ -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("");