Doxygen
Loading...
Searching...
No Matches
trace.cpp File Reference
#include "trace.h"
#include "spdlog/sinks/basic_file_sink.h"
#include "spdlog/sinks/stdout_sinks.h"
+ Include dependency graph for trace.cpp:

Go to the source code of this file.

Functions

void initTracing (const QCString &logFile, bool timing)
 
void exitTracing ()
 

Variables

std::shared_ptr< spdlog::logger > g_tracer
 

Function Documentation

◆ exitTracing()

void exitTracing ( )

Definition at line 52 of file trace.cpp.

53{
54 if (g_tracer)
55 {
56 spdlog::shutdown();
57 }
58}
std::shared_ptr< spdlog::logger > g_tracer
Definition trace.cpp:20

References g_tracer.

Referenced by generateOutput(), and stopDoxygen().

◆ initTracing()

void initTracing ( const QCString & logFile,
bool timing )

Definition at line 22 of file trace.cpp.

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

References g_tracer, QCString::isEmpty(), and QCString::str().

Referenced by readConfiguration().

Variable Documentation

◆ g_tracer

std::shared_ptr<spdlog::logger> g_tracer