Add TID debug printing

This commit is contained in:
Lion Kortlepel 2020-11-03 09:36:00 +01:00
parent 289bb1c1f3
commit 69f20bdf41
2 changed files with 9 additions and 0 deletions

View File

@ -5,6 +5,8 @@
#include <string>
#include <iostream>
void InitLog();
#define DebugPrintTID(what) DebugPrintTIDInternal(what, __func__)
void DebugPrintTIDInternal(const std::string& what, const std::string& func); // prints the current thread id in debug mode, to make tracing of crashes and asserts easier
void ConsoleOut(const std::string& msg);
void except(const std::string& toPrint);
void debug(const std::string& toPrint);

View File

@ -8,6 +8,13 @@
#include <sstream>
#include <chrono>
#include <mutex>
#include <thread>
void DebugPrintTIDInternal(const std::string& what, const std::string& func) {
std::stringstream ss;
ss << "Thread '" << std::this_thread::get_id() << "' in " << func << " is " << what;
debug(ss.str());
}
std::string getDate() {
typedef std::chrono::duration<int, std::ratio_multiply<std::chrono::hours::period, std::ratio<24>>::type> days;