21#define ENABLE_TRACING 1
23#define ENABLE_TRACING 0
29#define ENABLE_SYMBOLRESOLVER_TRACING 0
30#define ENABLE_MARKDOWN_TRACING 0
31#define ENABLE_DOCPARSER_TRACING 0
35#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE
37#define SPELOG_ACTIVE_LEVEL SPDLOG_LEVEL_INFO
40#pragma push_macro("warn")
42#include "spdlog/spdlog.h"
43#pragma pop_macro("warn")
49extern std::shared_ptr<spdlog::logger>
g_tracer;
63 if (c==
'\n') { result+=
"\\n"; }
64 else if (c==
'\t') { result+=
"\\t"; }
65 else if (c==
'\r') { result+=
"\\r"; }
66 else if (c==
'\\') { result+=
"\\\\"; }
69 if (i<s.
length()) result+=
"...";
75#define TRACE(...) if (g_tracer) SPDLOG_LOGGER_TRACE(g_tracer,__VA_ARGS__)
77#define TRACE(...) (void)0
91 template<
typename... Args>
93 const std::string &
fmt, Args&&...args) :
m_loc(loc)
103 g_tracer->log(
m_loc,spdlog::level::trace,fmt::runtime(
"> "+
fmt),std::forward<Args>(args)...);
123 template<
typename... Args>
124 void add(spdlog::source_loc loc,
125 const std::string &
fmt, Args&&...args)
129 g_tracer->log(loc,spdlog::level::trace,fmt::runtime(
": "+
fmt),std::forward<Args>(args)...);
132 template<
typename... Args>
134 const std::string &
msg,Args&&...args)
145#define AUTO_TRACE(...) AutoTrace trace_{spdlog::source_loc{__FILE__,__LINE__,SPDLOG_FUNCTION},__VA_ARGS__}
146#define AUTO_TRACE_ADD(...) trace_.add(spdlog::source_loc{__FILE__,__LINE__,SPDLOG_FUNCTION},__VA_ARGS__)
147#define AUTO_TRACE_EXIT(...) trace_.setExit(spdlog::source_loc{__FILE__,__LINE__,SPDLOG_FUNCTION},__VA_ARGS__)
149#define AUTO_TRACE(...) (void)0
150#define AUTO_TRACE_ADD(...) (void)0
151#define AUTO_TRACE_EXIT(...) (void)0
Helper class to trace an entry statement at creation and another one at destruction.
AutoTrace(spdlog::source_loc loc, const std::string &fmt, Args &&...args)
AutoTrace(spdlog::source_loc loc)
std::string m_exitMessage
void add(spdlog::source_loc loc, const std::string &fmt, Args &&...args)
void setExit(spdlog::source_loc loc, const std::string &msg, Args &&...args)
This is an alternative implementation of QCString.
size_t length() const
Returns the length of the string, not counting the 0-terminator.
char & at(size_t i)
Returns a reference to the character at index i.
#define NON_COPYABLE(cls)
Macro to help implementing the rule of 5 for a non-copyable & movable class.
QCString trunc(const QCString &s, size_t numChars=15)
std::shared_ptr< spdlog::logger > g_tracer
std::shared_ptr< spdlog::logger > g_tracer
void initTracing(const QCString &logFile, bool timing)