tor  0.4.2.0-alpha-dev
debug.h
Go to the documentation of this file.
1 /* Copyright (c) 2017-2019, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
3 
9 #ifndef TOR_TRACE_LOG_DEBUG_H
10 #define TOR_TRACE_LOG_DEBUG_H
11 
12 #include "lib/log/log.h"
13 
14 /* Stringify pre-processor trick. */
15 #define XSTR(d) STR(d)
16 #define STR(s) #s
17 
18 /* Send every event to a debug log level. This is useful to debug new trace
19  * events without implementing them for a specific event tracing framework.
20  * Note that the arguments are ignored since at this step we do not know the
21  * types and amount there is. */
22 
23 /* Example on how to map a tracepoint to log_debug(). */
24 #undef tor_trace
25 #define tor_trace(subsystem, name, args...) \
26  log_debug(LD_GENERAL, "Trace event \"" XSTR(name) "\" from " \
27  "\"" XSTR(subsystem) "\" hit. " \
28  "(line "XSTR(__LINE__) ")")
29 
30 #endif /* !defined(TOR_TRACE_LOG_DEBUG_H) */
Headers for log.c.