Skip to content

Commit

Permalink
refactor: slim down trace.h
Browse files Browse the repository at this point in the history
  • Loading branch information
Swiftb0y committed Sep 23, 2024
1 parent 1708a67 commit b49184d
Showing 1 changed file with 4 additions and 23 deletions.
27 changes: 4 additions & 23 deletions src/util/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,14 @@

class Trace {
public:
Trace(const char* tag, const char* arg=NULL,
bool writeToStdout=false, bool time=true)
Trace(const char* tag, const char* arg = nullptr, bool writeToStdout = false, bool time = true)
: m_writeToStdout(writeToStdout),
m_time(time) {
if (writeToStdout || CmdlineArgs::Instance().getDeveloper()) {
initialize(tag, arg);
}
}

Trace(const char* tag, int arg,
bool writeToStdout=false, bool time=true)
: m_writeToStdout(writeToStdout),
m_time(time) {
if (writeToStdout || CmdlineArgs::Instance().getDeveloper()) {
initialize(tag, QString::number(arg));
}
}

Trace(const char* tag, const QString& arg,
bool writeToStdout=false, bool time=true)
: m_writeToStdout(writeToStdout),
Expand All @@ -38,7 +28,7 @@ class Trace {
}
}

virtual ~Trace() {
~Trace() {
// Proxy for whether initialize was called.
if (m_tag.isEmpty()) {
return;
Expand Down Expand Up @@ -86,16 +76,7 @@ class Trace {
}

QString m_tag;
const bool m_writeToStdout, m_time;
PerformanceTimer m_timer;

};

class DebugTrace : public Trace {
public:
DebugTrace(const char* tag, bool time=true)
: Trace(tag, "", CmdlineArgs::Instance().getDeveloper(), time) {
}
virtual ~DebugTrace() {
}
bool m_writeToStdout;
bool m_time;
};

0 comments on commit b49184d

Please sign in to comment.