Merge branch 'maint-0.3.2' into release-0.3.2
[tor/appveyor.git] / src / trace / events.h
blob1be1fd596e547e7488110fcb2540ea09e7be8e09
1 /* Copyright (c) 2017, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
4 /**
5 * \file events.h
6 * \brief Header file for Tor event tracing.
7 **/
9 #ifndef TOR_TRACE_EVENTS_H
10 #define TOR_TRACE_EVENTS_H
13 * The following defines a generic event tracing function name that has to be
14 * used to trace events in the code base.
16 * That generic function is then defined by a event tracing framework. For
17 * instance, the "log debug" framework sends all trace events to log_debug()
18 * which is defined in src/trace/debug.h which can only be enabled at compile
19 * time (--enable-event-tracing-debug).
21 * By default, every trace events in the code base are replaced by a NOP. See
22 * doc/HACKING/Tracing.md for more information on how to use event tracing or
23 * add events.
26 #ifdef TOR_EVENT_TRACING_ENABLED
27 /* Map every trace event to a per subsystem macro. */
28 #define tor_trace(subsystem, name, ...) \
29 tor_trace_##subsystem(name, __VA_ARGS__)
31 /* Enable event tracing for the debug framework where all trace events are
32 * mapped to a log_debug(). */
33 #ifdef USE_EVENT_TRACING_DEBUG
34 #include "trace/debug.h"
35 #endif
37 #else /* TOR_EVENT_TRACING_ENABLED */
39 /* Reaching this point, we NOP every event declaration because event tracing
40 * is not been enabled at compile time. */
41 #define tor_trace(subsystem, name, args...)
43 #endif /* TOR_EVENT_TRACING_ENABLED */
45 #endif /* TOR_TRACE_EVENTS_H */