X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Flist.c;h=f69d34db99aab59b115cf3c6cdf9b77f2a3a9252;hp=ea9427f4770f158458f6e8e79456f2f7d7b6c91b;hb=6c1c0768320135c6936c371b09731851b508c023;hpb=970d848b0e1e8e81bc7be0fb43e1fcdcd5a84da7 diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c index ea9427f47..f69d34db9 100644 --- a/src/bin/lttng/commands/list.c +++ b/src/bin/lttng/commands/list.c @@ -16,6 +16,7 @@ */ #define _GNU_SOURCE +#define _LGPL_SOURCE #include #include #include @@ -31,6 +32,7 @@ static int opt_userspace; static int opt_kernel; static int opt_jul; static int opt_log4j; +static int opt_python; static char *opt_channel; static int opt_domain; static int opt_fields; @@ -60,6 +62,7 @@ static struct poptOption long_options[] = { {"kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0}, {"jul", 'j', POPT_ARG_VAL, &opt_jul, 1, 0, 0}, {"log4j", 'l', POPT_ARG_VAL, &opt_log4j, 1, 0, 0}, + {"python", 'p', POPT_ARG_VAL, &opt_python, 1, 0, 0}, #if 0 /* Not implemented yet */ {"userspace", 'u', POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &opt_cmd_name, OPT_USERSPACE, 0, 0}, @@ -93,6 +96,7 @@ static void usage(FILE *ofp) fprintf(ofp, " -u, --userspace Select user-space domain.\n"); fprintf(ofp, " -j, --jul Apply for Java application using JUL\n"); fprintf(ofp, " -l, --log4j Apply for Java application using LOG4J\n"); + fprintf(ofp, " -p, --python Apply for Python application using logging\n"); fprintf(ofp, " -f, --fields List event fields.\n"); fprintf(ofp, " --syscall List available system calls.\n"); #if 0 @@ -427,6 +431,8 @@ static int list_agent_events(void) domain.type = LTTNG_DOMAIN_JUL; } else if (opt_log4j) { domain.type = LTTNG_DOMAIN_LOG4J; + } else if (opt_python) { + domain.type = LTTNG_DOMAIN_PYTHON; } agent_domain_str = get_domain_str(domain.type); @@ -1202,7 +1208,7 @@ static int list_channels(const char *channel_name) } } else { /* Pretty print */ - if (channel_name == NULL) { + if (count) { MSG("Channels:\n-------------"); } @@ -1469,6 +1475,9 @@ static int list_domains(const char *session_name) case LTTNG_DOMAIN_LOG4J: MSG(" - LOG4j (Logging for Java)"); break; + case LTTNG_DOMAIN_PYTHON: + MSG(" - Python (logging)"); + break; default: break; } @@ -1561,6 +1570,8 @@ int cmd_list(int argc, const char **argv) domain.type = LTTNG_DOMAIN_JUL; } else if (opt_log4j) { domain.type = LTTNG_DOMAIN_LOG4J; + } else if (opt_python) { + domain.type = LTTNG_DOMAIN_PYTHON; } if (!opt_kernel && opt_syscall) { @@ -1569,7 +1580,7 @@ int cmd_list(int argc, const char **argv) goto end; } - if (opt_kernel || opt_userspace || opt_jul || opt_log4j) { + if (opt_kernel || opt_userspace || opt_jul || opt_log4j || opt_python) { handle = lttng_create_handle(session_name, &domain); if (handle == NULL) { ret = CMD_FATAL; @@ -1578,7 +1589,8 @@ int cmd_list(int argc, const char **argv) } if (session_name == NULL) { - if (!opt_kernel && !opt_userspace && !opt_jul && !opt_log4j) { + if (!opt_kernel && !opt_userspace && !opt_jul && !opt_log4j + && !opt_python) { ret = list_sessions(NULL); if (ret) { goto end; @@ -1607,7 +1619,7 @@ int cmd_list(int argc, const char **argv) goto end; } } - if (opt_jul || opt_log4j) { + if (opt_jul || opt_log4j || opt_python) { ret = list_agent_events(); if (ret) { goto end; @@ -1705,6 +1717,9 @@ int cmd_list(int argc, const char **argv) case LTTNG_DOMAIN_LOG4J: MSG("=== Domain: LOG4j (Logging for Java) ===\n"); break; + case LTTNG_DOMAIN_PYTHON: + MSG("=== Domain: Python (logging) ===\n"); + break; default: MSG("=== Domain: Unimplemented ===\n"); break; @@ -1730,7 +1745,8 @@ int cmd_list(int argc, const char **argv) } if (domains[i].type == LTTNG_DOMAIN_JUL || - domains[i].type == LTTNG_DOMAIN_LOG4J) { + domains[i].type == LTTNG_DOMAIN_LOG4J || + domains[i].type == LTTNG_DOMAIN_PYTHON) { ret = list_session_agent_events(); if (ret) { goto end;