Doxygen
Loading...
Searching...
No Matches
trace.h File Reference

#include <src/trace.h>

Include dependency graph for trace.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  AutoTrace
 Helper class to trace an entry statement at creation and another one at destruction. More...

Namespaces

namespace  Trace

Macros

#define ENABLE_TRACING   1
#define ENABLE_SYMBOLRESOLVER_TRACING   0
#define ENABLE_MARKDOWN_TRACING   0
#define ENABLE_DOCPARSER_TRACING   0
#define SPELOG_ACTIVE_LEVEL   SPDLOG_LEVEL_INFO
#define TRACE(...)
#define AUTO_TRACE(...)
#define AUTO_TRACE_ADD(...)
#define AUTO_TRACE_EXIT(...)

Functions

void initTracing (const DString &logFile, bool timing)
void exitTracing ()
DString Trace::trunc (const DString &s, size_t numChars=15)

Variables

std::shared_ptr< spdlog::logger > g_tracer

Macro Definition Documentation

◆ AUTO_TRACE

#define AUTO_TRACE ( ...)
Value:
(void)0

Definition at line 149 of file trace.h.

◆ AUTO_TRACE_ADD

#define AUTO_TRACE_ADD ( ...)
Value:
(void)0

Definition at line 150 of file trace.h.

◆ AUTO_TRACE_EXIT

#define AUTO_TRACE_EXIT ( ...)
Value:
(void)0

Definition at line 151 of file trace.h.

◆ ENABLE_DOCPARSER_TRACING

#define ENABLE_DOCPARSER_TRACING   0

Definition at line 31 of file trace.h.

◆ ENABLE_MARKDOWN_TRACING

#define ENABLE_MARKDOWN_TRACING   0

Definition at line 30 of file trace.h.

◆ ENABLE_SYMBOLRESOLVER_TRACING

#define ENABLE_SYMBOLRESOLVER_TRACING   0

Definition at line 29 of file trace.h.

◆ ENABLE_TRACING

#define ENABLE_TRACING   1

Definition at line 21 of file trace.h.

◆ SPELOG_ACTIVE_LEVEL

#define SPELOG_ACTIVE_LEVEL   SPDLOG_LEVEL_INFO

Definition at line 37 of file trace.h.

◆ TRACE

#define TRACE ( ...)
Value:
(void)0

Definition at line 77 of file trace.h.

Referenced by computeVerifiedDotPath(), and readConfiguration().

Function Documentation

◆ exitTracing()

void exitTracing ( )

Definition at line 55 of file trace.cpp.

56{
57 if (g_tracer)
58 {
59 spdlog::shutdown();
60 }
61}
std::shared_ptr< spdlog::logger > g_tracer
Definition trace.cpp:23

References g_tracer.

Referenced by generateOutput(), and stopDoxygen().

◆ initTracing()

void initTracing ( const DString & logFile,
bool timing )

Definition at line 25 of file trace.cpp.

26{
27 if (!logFile.empty())
28 {
29 std::vector<spdlog::sink_ptr> sinks;
30 if (logFile=="stdout")
31 {
32 sinks.push_back(std::make_shared<spdlog::sinks::stdout_sink_mt>());
33 }
34 else if (logFile=="stderr")
35 {
36 sinks.push_back(std::make_shared<spdlog::sinks::stderr_sink_mt>());
37 }
38 else // normal file
39 {
40 sinks.push_back(std::make_shared<spdlog::sinks::basic_file_sink_mt>(logFile.str(),true));
41 }
42 g_tracer = std::make_shared<spdlog::logger>("tracing", sinks.begin(),sinks.end());
43 g_tracer->set_level(spdlog::level::trace);
44 if (timing)
45 {
46 g_tracer->set_pattern("[%C-%m-%d %T.%e][%t][%s:%#](%!) %v");
47 }
48 else
49 {
50 g_tracer->set_pattern("[%s:%#](%!) %v");
51 }
52 }
53}
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
const std::string & str() const
Definition dstring.h:645

References DString::empty(), g_tracer, and DString::str().

Referenced by readConfiguration().

Variable Documentation

◆ g_tracer

std::shared_ptr<spdlog::logger> g_tracer
extern