fix tracelog namespacing of loglevels
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 9 Jun 2015 14:38:21 +0000 (16:38 +0200)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 9 Jun 2015 14:38:21 +0000 (16:38 +0200)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
doc/examples/demo-tracelog/README
doc/examples/demo-tracelog/demo-tracelog.c
doc/man/lttng-ust.3
include/lttng/lttng-ust-tracelog.h
include/lttng/tracelog.h
liblttng-ust/tracelog.c

index 46fe7679c6e9736470f67f66fa449d34c9c47b3e..83f259e5f752099bf98cbd5de4f5b23cd8a39f47 100644 (file)
@@ -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" }
index aeeb621119ef5736c2fdd7e680237cf93333a98d..1aaaadbdba06e14e9107d78ac9169aa9a8f8f156 100644 (file)
@@ -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;
index f57d7f880926fe6481248a16b731e5ad0d5cc28d..15b4989b692dd025634416ba9c1034f23b105ead 100644 (file)
@@ -57,7 +57,7 @@ To do it, in a nutshell:
 1) #include <lttng/tracelog.h>
 
 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
 
index 5b1c940aa873eea61c324284318dacfff4594528..50b8054b15be6e1495af5b5b17bd02dcac48b97f 100644 (file)
@@ -23,8 +23,8 @@
 #include <lttng/tracepoint.h>
 #include <stdarg.h>
 
-#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( \
                        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)
index 50ef4ff0d8b581fc2ee2ede81cd4eed9395e40c1..5f14f70d458b093c18ca294b2c43e79cf6e1c4c5 100644 (file)
@@ -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)
index 0e42b4b163d6bbdc61bf1556f8e30bb0e9376c99..93eb403a6bde5807d955f2351afc543384443356 100644 (file)
                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)
This page took 0.031018 seconds and 4 git commands to generate.