Initial import
[lttng-docs.git] / contents / using-lttng / instrumenting / c-application / assigning-log-levels.md
1 ---
2 id: assigning-log-levels
3 ---
4
5 Optionally, a log level can be assigned to a defined tracepoint.
6 Assigning different levels of importance to tracepoints can be useful;
7 when controlling tracing sessions,
8 [you can choose](#doc-controlling-tracing) to only enable tracepoints
9 falling into a specific log level range.
10
11 Log levels are assigned to defined tracepoints using the
12 `TRACEPOINT_LOGLEVEL()` macro. The latter must be used _after_ having
13 used `TRACEPOINT_EVENT()` for a given tracepoint. The
14 `TRACEPOINT_LOGLEVEL()` macro has the following construct:
15
16 ~~~ c
17 TRACEPOINT_LOGLEVEL(<provider name>, <tracepoint name>, <log level>)
18 ~~~
19
20 where the first two arguments are the same as the first two arguments
21 of `TRACEPOINT_EVENT()` and `<log level>` is one
22 of the values given in the
23 [LTTng-UST library reference](#doc-liblttng-ust-tracepoint-loglevel)
24 section.
25
26 As an example, let's assign a `TRACE_DEBUG_UNIT` log level to our
27 previous tracepoint definition:
28
29 ~~~ c
30 TRACEPOINT_LOGLEVEL(my_provider, my_tracepoint, TRACE_DEBUG_UNIT)
31 ~~~
This page took 0.030997 seconds and 5 git commands to generate.