mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-27 07:59:35 +01:00
This commit adds the src/trace directory containing the basics for our tracing subsystem. It is not used in the code base. The "src/trace/debug.h" file contains an example on how we can map our tor trace events to log_debug(). The tracing subsystem can only be enabled by tracing framework at compile time. This commit introduces the "--enable-tracing-debug" option that will make all "tor_trace()" function be maped to "log_debug()". Closes #13802 Signed-off-by: David Goulet <dgoulet@torproject.org>
25 lines
848 B
C
25 lines
848 B
C
/* Copyright (c) 2017, The Tor Project, Inc. */
|
|
/* See LICENSE for licensing information */
|
|
|
|
#ifndef TOR_TRACE_LOG_DEBUG_H
|
|
#define TOR_TRACE_LOG_DEBUG_H
|
|
|
|
#include "torlog.h"
|
|
|
|
/* Stringify pre-processor trick. */
|
|
#define XSTR(d) STR(d)
|
|
#define STR(s) #s
|
|
|
|
/* Send every event to a debug log level. This is useful to debug new trace
|
|
* events without implementing them for a specific event tracing framework.
|
|
* Note that the arguments are ignored since at this step we do not know the
|
|
* types and amount there is. */
|
|
|
|
/* Example on how to map a tracepoint to log_debug(). */
|
|
#undef tor_trace
|
|
#define tor_trace(subsystem, name, args...) \
|
|
log_debug(LD_GENERAL, "Trace event \"" XSTR(name) "\" from " \
|
|
"\"" XSTR(subsystem) "\" hit. " \
|
|
"(line "XSTR(__LINE__) ")")
|
|
|
|
#endif /* TOR_TRACE_LOG_DEBUG_H */
|