debug.h 861 B

12345678910111213141516171819202122232425
  1. /* Copyright (c) 2017-2018, The Tor Project, Inc. */
  2. /* See LICENSE for licensing information */
  3. #ifndef TOR_TRACE_LOG_DEBUG_H
  4. #define TOR_TRACE_LOG_DEBUG_H
  5. #include "lib/log/torlog.h"
  6. /* Stringify pre-processor trick. */
  7. #define XSTR(d) STR(d)
  8. #define STR(s) #s
  9. /* Send every event to a debug log level. This is useful to debug new trace
  10. * events without implementing them for a specific event tracing framework.
  11. * Note that the arguments are ignored since at this step we do not know the
  12. * types and amount there is. */
  13. /* Example on how to map a tracepoint to log_debug(). */
  14. #undef tor_trace
  15. #define tor_trace(subsystem, name, args...) \
  16. log_debug(LD_GENERAL, "Trace event \"" XSTR(name) "\" from " \
  17. "\"" XSTR(subsystem) "\" hit. " \
  18. "(line "XSTR(__LINE__) ")")
  19. #endif /* TOR_TRACE_LOG_DEBUG_H */