From: Mathieu Desnoyers Date: Tue, 9 Jun 2015 14:38:21 +0000 (+0200) Subject: fix tracelog namespacing of loglevels X-Git-Tag: v2.7.0-rc1~31 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=c4d667edf49aa27d106c1855ff2fa4560be8d6f3;p=lttng-ust.git fix tracelog namespacing of loglevels Signed-off-by: Mathieu Desnoyers --- diff --git a/doc/examples/demo-tracelog/README b/doc/examples/demo-tracelog/README index 46fe7679..83f259e5 100644 --- a/doc/examples/demo-tracelog/README +++ b/doc/examples/demo-tracelog/README @@ -13,8 +13,8 @@ lttng destroy The resulting lttng view output should look like this: -[15:54:19.454863179] (+?.?????????) thinkos lttng_ust_tracelog:err: { cpu_id = 0 }, { line = 45, file = "demo-tracelog.c", func = "main", _msg_length = 17, msg = "Error condition 0" } -[15:54:19.454871660] (+0.000008481) thinkos lttng_ust_tracelog:err: { cpu_id = 0 }, { line = 45, file = "demo-tracelog.c", func = "main", _msg_length = 17, msg = "Error condition 1" } -[15:54:19.454872838] (+0.000001178) thinkos lttng_ust_tracelog:err: { cpu_id = 0 }, { line = 45, file = "demo-tracelog.c", func = "main", _msg_length = 17, msg = "Error condition 2" } -[15:54:19.454873541] (+0.000000703) thinkos lttng_ust_tracelog:err: { cpu_id = 0 }, { line = 45, file = "demo-tracelog.c", func = "main", _msg_length = 17, msg = "Error condition 3" } -[15:54:19.454874283] (+0.000000742) thinkos lttng_ust_tracelog:err: { cpu_id = 0 }, { line = 45, file = "demo-tracelog.c", func = "main", _msg_length = 17, msg = "Error condition 4" } +[15:54:19.454863179] (+?.?????????) thinkos lttng_ust_tracelog:TRACE_ERR: { cpu_id = 0 }, { line = 45, file = "demo-tracelog.c", func = "main", _msg_length = 17, msg = "Error condition 0" } +[15:54:19.454871660] (+0.000008481) thinkos lttng_ust_tracelog:TRACE_ERR: { cpu_id = 0 }, { line = 45, file = "demo-tracelog.c", func = "main", _msg_length = 17, msg = "Error condition 1" } +[15:54:19.454872838] (+0.000001178) thinkos lttng_ust_tracelog:TRACE_ERR: { cpu_id = 0 }, { line = 45, file = "demo-tracelog.c", func = "main", _msg_length = 17, msg = "Error condition 2" } +[15:54:19.454873541] (+0.000000703) thinkos lttng_ust_tracelog:TRACE_ERR: { cpu_id = 0 }, { line = 45, file = "demo-tracelog.c", func = "main", _msg_length = 17, msg = "Error condition 3" } +[15:54:19.454874283] (+0.000000742) thinkos lttng_ust_tracelog:TRACE_ERR: { cpu_id = 0 }, { line = 45, file = "demo-tracelog.c", func = "main", _msg_length = 17, msg = "Error condition 4" } diff --git a/doc/examples/demo-tracelog/demo-tracelog.c b/doc/examples/demo-tracelog/demo-tracelog.c index aeeb6211..1aaaadbd 100644 --- a/doc/examples/demo-tracelog/demo-tracelog.c +++ b/doc/examples/demo-tracelog/demo-tracelog.c @@ -37,7 +37,7 @@ int main(int argc, char **argv) fprintf(stderr, "Tracing... "); for (i = 0; i < 5; i++) { - tracelog(err, "Error condition %d", i); + tracelog(TRACE_ERR, "Error condition %d", i); } fprintf(stderr, " done.\n"); return 0; diff --git a/doc/man/lttng-ust.3 b/doc/man/lttng-ust.3 index f57d7f88..15b4989b 100644 --- a/doc/man/lttng-ust.3 +++ b/doc/man/lttng-ust.3 @@ -57,7 +57,7 @@ To do it, in a nutshell: 1) #include 2) /* in your code, use like a printf, with extra loglevel info. */ - tracelog(info, "Message with integer %d", 1234); + tracelog(TRACE_INFO, "Message with integer %d", 1234); 3) Link your program against liblttng-ust.so. @@ -76,9 +76,10 @@ That's it! You can replace the enable-event line above with a selection of loglevels, e.g.: - lttng enable-event -u -a --loglevel INFO + lttng enable-event -u -a --loglevel TRACE_INFO -Which will gather all events from INFO and more important loglevels. +Which will gather all events from TRACE_INFO and more important +loglevels. .PP diff --git a/include/lttng/lttng-ust-tracelog.h b/include/lttng/lttng-ust-tracelog.h index 5b1c940a..50b8054b 100644 --- a/include/lttng/lttng-ust-tracelog.h +++ b/include/lttng/lttng-ust-tracelog.h @@ -23,8 +23,8 @@ #include #include -#define TP_TRACELOG_TEMPLATE(_level_identifier, _level_enum) \ - TRACEPOINT_EVENT(lttng_ust_tracelog, _level_identifier, \ +#define TP_TRACELOG_TEMPLATE(_level_enum) \ + TRACEPOINT_EVENT(lttng_ust_tracelog, _level_enum, \ TP_ARGS(const char *, file, int, line, const char *, func, \ const char *, msg, unsigned int, len, void *, ip), \ TP_FIELDS( \ @@ -34,21 +34,20 @@ ctf_sequence_text(char, msg, msg, unsigned int, len) \ ) \ ) \ - TRACEPOINT_LOGLEVEL(lttng_ust_tracelog, _level_identifier, \ - TRACE_##_level_enum) + TRACEPOINT_LOGLEVEL(lttng_ust_tracelog, _level_enum, _level_enum) -TP_TRACELOG_TEMPLATE(emerg, EMERG) -TP_TRACELOG_TEMPLATE(alert, ALERT) -TP_TRACELOG_TEMPLATE(crit, CRIT) -TP_TRACELOG_TEMPLATE(err, ERR) -TP_TRACELOG_TEMPLATE(warning, WARNING) -TP_TRACELOG_TEMPLATE(notice, NOTICE) -TP_TRACELOG_TEMPLATE(info, INFO) -TP_TRACELOG_TEMPLATE(debug_system, DEBUG_SYSTEM) -TP_TRACELOG_TEMPLATE(debug_program, DEBUG_PROGRAM) -TP_TRACELOG_TEMPLATE(debug_process, DEBUG_PROCESS) -TP_TRACELOG_TEMPLATE(debug_module, DEBUG_MODULE) -TP_TRACELOG_TEMPLATE(debug_unit, DEBUG_UNIT) -TP_TRACELOG_TEMPLATE(debug_function, DEBUG_FUNCTION) -TP_TRACELOG_TEMPLATE(debug_line, DEBUG_LINE) -TP_TRACELOG_TEMPLATE(debug, DEBUG) +TP_TRACELOG_TEMPLATE(TRACE_EMERG) +TP_TRACELOG_TEMPLATE(TRACE_ALERT) +TP_TRACELOG_TEMPLATE(TRACE_CRIT) +TP_TRACELOG_TEMPLATE(TRACE_ERR) +TP_TRACELOG_TEMPLATE(TRACE_WARNING) +TP_TRACELOG_TEMPLATE(TRACE_NOTICE) +TP_TRACELOG_TEMPLATE(TRACE_INFO) +TP_TRACELOG_TEMPLATE(TRACE_DEBUG_SYSTEM) +TP_TRACELOG_TEMPLATE(TRACE_DEBUG_PROGRAM) +TP_TRACELOG_TEMPLATE(TRACE_DEBUG_PROCESS) +TP_TRACELOG_TEMPLATE(TRACE_DEBUG_MODULE) +TP_TRACELOG_TEMPLATE(TRACE_DEBUG_UNIT) +TP_TRACELOG_TEMPLATE(TRACE_DEBUG_FUNCTION) +TP_TRACELOG_TEMPLATE(TRACE_DEBUG_LINE) +TP_TRACELOG_TEMPLATE(TRACE_DEBUG) diff --git a/include/lttng/tracelog.h b/include/lttng/tracelog.h index 50ef4ff0..5f14f70d 100644 --- a/include/lttng/tracelog.h +++ b/include/lttng/tracelog.h @@ -33,28 +33,28 @@ extern "C" { extern void _lttng_ust_tracelog_##level(const char *file, \ int line, const char *func, const char *fmt, ...) -TP_TRACELOG_CB_TEMPLATE(emerg); -TP_TRACELOG_CB_TEMPLATE(alert); -TP_TRACELOG_CB_TEMPLATE(crit); -TP_TRACELOG_CB_TEMPLATE(err); -TP_TRACELOG_CB_TEMPLATE(warning); -TP_TRACELOG_CB_TEMPLATE(notice); -TP_TRACELOG_CB_TEMPLATE(info); -TP_TRACELOG_CB_TEMPLATE(debug_system); -TP_TRACELOG_CB_TEMPLATE(debug_program); -TP_TRACELOG_CB_TEMPLATE(debug_process); -TP_TRACELOG_CB_TEMPLATE(debug_module); -TP_TRACELOG_CB_TEMPLATE(debug_unit); -TP_TRACELOG_CB_TEMPLATE(debug_function); -TP_TRACELOG_CB_TEMPLATE(debug_line); -TP_TRACELOG_CB_TEMPLATE(debug); +TP_TRACELOG_CB_TEMPLATE(TRACE_EMERG); +TP_TRACELOG_CB_TEMPLATE(TRACE_ALERT); +TP_TRACELOG_CB_TEMPLATE(TRACE_CRIT); +TP_TRACELOG_CB_TEMPLATE(TRACE_ERR); +TP_TRACELOG_CB_TEMPLATE(TRACE_WARNING); +TP_TRACELOG_CB_TEMPLATE(TRACE_NOTICE); +TP_TRACELOG_CB_TEMPLATE(TRACE_INFO); +TP_TRACELOG_CB_TEMPLATE(TRACE_DEBUG_SYSTEM); +TP_TRACELOG_CB_TEMPLATE(TRACE_DEBUG_PROGRAM); +TP_TRACELOG_CB_TEMPLATE(TRACE_DEBUG_PROCESS); +TP_TRACELOG_CB_TEMPLATE(TRACE_DEBUG_MODULE); +TP_TRACELOG_CB_TEMPLATE(TRACE_DEBUG_UNIT); +TP_TRACELOG_CB_TEMPLATE(TRACE_DEBUG_FUNCTION); +TP_TRACELOG_CB_TEMPLATE(TRACE_DEBUG_LINE); +TP_TRACELOG_CB_TEMPLATE(TRACE_DEBUG); #undef TP_TRACELOG_CB_TEMPLATE #define tracelog(level, fmt, ...) \ do { \ STAP_PROBEV(tracepoint_lttng_ust_tracelog, level, ## __VA_ARGS__); \ - if (caa_unlikely(__tracepoint_lttng_ust_tracelog___## level.state)) \ + if (caa_unlikely(__tracepoint_lttng_ust_tracelog___##level.state)) \ _lttng_ust_tracelog_##level(__FILE__, __LINE__, __func__, \ fmt, ## __VA_ARGS__); \ } while (0) diff --git a/liblttng-ust/tracelog.c b/liblttng-ust/tracelog.c index 0e42b4b1..93eb403a 100644 --- a/liblttng-ust/tracelog.c +++ b/liblttng-ust/tracelog.c @@ -50,18 +50,18 @@ va_end(ap); \ } -TRACELOG_CB(emerg) -TRACELOG_CB(alert) -TRACELOG_CB(crit) -TRACELOG_CB(err) -TRACELOG_CB(warning) -TRACELOG_CB(notice) -TRACELOG_CB(info) -TRACELOG_CB(debug_system) -TRACELOG_CB(debug_program) -TRACELOG_CB(debug_process) -TRACELOG_CB(debug_module) -TRACELOG_CB(debug_unit) -TRACELOG_CB(debug_function) -TRACELOG_CB(debug_line) -TRACELOG_CB(debug) +TRACELOG_CB(TRACE_EMERG) +TRACELOG_CB(TRACE_ALERT) +TRACELOG_CB(TRACE_CRIT) +TRACELOG_CB(TRACE_ERR) +TRACELOG_CB(TRACE_WARNING) +TRACELOG_CB(TRACE_NOTICE) +TRACELOG_CB(TRACE_INFO) +TRACELOG_CB(TRACE_DEBUG_SYSTEM) +TRACELOG_CB(TRACE_DEBUG_PROGRAM) +TRACELOG_CB(TRACE_DEBUG_PROCESS) +TRACELOG_CB(TRACE_DEBUG_MODULE) +TRACELOG_CB(TRACE_DEBUG_UNIT) +TRACELOG_CB(TRACE_DEBUG_FUNCTION) +TRACELOG_CB(TRACE_DEBUG_LINE) +TRACELOG_CB(TRACE_DEBUG)