20 #ifndef CC_PROCESS_LOG_EVENT_TO_PARENT 21 #define CC_PROCESS_LOG_EVENT_TO_PARENT 0 25 #undef CC_PROCESS_LOG_EVENT_TO_PARENT 26 #define CC_PROCESS_LOG_EVENT_TO_PARENT 1 40 void Init(
wxEvtHandler* parent,
int logId,
int debugLogId,
int addTokenId = -1);
53 static std::unique_ptr<CCLogger>
s_Inst;
65 #define CC_ENABLE_LOCKER_ASSERT 68 #if defined(CC_ENABLE_LOCKER_TRACK) 71 #define THREAD_LOCKER_MTX_LOCK(NAME) \ 72 CCLogger::Get()->DebugLog(F(_T("%s.Lock() : %s(), %s, %d"), \ 73 wxString(#NAME, wxConvUTF8).wx_str(), \ 74 wxString(__FUNCTION__, wxConvUTF8).wx_str(), \ 75 wxString(__FILE__, wxConvUTF8).wx_str(), \ 77 #define THREAD_LOCKER_MTX_LOCK_SUCCESS(NAME) \ 78 CCLogger::Get()->DebugLog(F(_T("%s.Lock().Success() : %s(), %s, %d"), \ 79 wxString(#NAME, wxConvUTF8).wx_str(), \ 80 wxString(__FUNCTION__, wxConvUTF8).wx_str(), \ 81 wxString(__FILE__, wxConvUTF8).wx_str(), \ 83 #define THREAD_LOCKER_MTX_UNLOCK(NAME) \ 84 CCLogger::Get()->DebugLog(F(_T("%s.Unlock() : %s(), %s, %d"), \ 85 wxString(#NAME, wxConvUTF8).wx_str(), \ 86 wxString(__FUNCTION__, wxConvUTF8).wx_str(), \ 87 wxString(__FILE__, wxConvUTF8).wx_str(), \ 89 #define THREAD_LOCKER_MTX_UNLOCK_SUCCESS(NAME) \ 90 CCLogger::Get()->DebugLog(F(_T("%s.Unlock().Success() : %s(), %s, %d"), \ 91 wxString(#NAME, wxConvUTF8).wx_str(), \ 92 wxString(__FUNCTION__, wxConvUTF8).wx_str(), \ 93 wxString(__FILE__, wxConvUTF8).wx_str(), \ 95 #define THREAD_LOCKER_MTX_FAIL(NAME) \ 96 CCLogger::Get()->DebugLog(F(_T("%s.Fail() : %s(), %s, %d"), \ 97 wxString(#NAME, wxConvUTF8).wx_str(), \ 98 wxString(__FUNCTION__, wxConvUTF8).wx_str(), \ 99 wxString(__FILE__, wxConvUTF8).wx_str(), \ 102 #define CC_LOCKER_TRACK_TT_MTX_LOCK(M) \ 104 THREAD_LOCKER_MTX_LOCK(M); \ 105 if (M.Lock()==wxMUTEX_NO_ERROR) \ 106 THREAD_LOCKER_MTX_LOCK_SUCCESS(M); \ 108 THREAD_LOCKER_MTX_FAIL(M); \ 110 #define CC_LOCKER_TRACK_TT_MTX_UNLOCK(M) \ 112 THREAD_LOCKER_MTX_UNLOCK(M); \ 113 if (M.Unlock()==wxMUTEX_NO_ERROR) \ 114 THREAD_LOCKER_MTX_UNLOCK_SUCCESS(M); \ 116 THREAD_LOCKER_MTX_FAIL(M); \ 118 #define CC_LOCKER_TRACK_CBBT_MTX_LOCK CC_LOCKER_TRACK_TT_MTX_LOCK 119 #define CC_LOCKER_TRACK_CBBT_MTX_UNLOCK CC_LOCKER_TRACK_TT_MTX_UNLOCK 120 #define CC_LOCKER_TRACK_P_MTX_LOCK CC_LOCKER_TRACK_TT_MTX_LOCK 121 #define CC_LOCKER_TRACK_P_MTX_UNLOCK CC_LOCKER_TRACK_TT_MTX_UNLOCK 125 #define THREAD_LOCKER_CS_ENTER(NAME) \ 126 CCLogger::Get()->DebugLog(F(_T("%s.Enter() : %s(), %s, %d"), \ 127 wxString(#NAME, wxConvUTF8).wx_str(), \ 128 wxString(__FUNCTION__, wxConvUTF8).wx_str(), \ 129 wxString(__FILE__, wxConvUTF8).wx_str(), \ 131 #define THREAD_LOCKER_CS_ENTERED(NAME) \ 132 CCLogger::Get()->DebugLog(F(_T("%s.Entered() : %s(), %s, %d"), \ 133 wxString(#NAME, wxConvUTF8).wx_str(), \ 134 wxString(__FUNCTION__, wxConvUTF8).wx_str(), \ 135 wxString(__FILE__, wxConvUTF8).wx_str(), \ 137 #define THREAD_LOCKER_CS_LEAVE(NAME) \ 138 CCLogger::Get()->DebugLog(F(_T("%s.Leave() : %s(), %s, %d"), \ 139 wxString(#NAME, wxConvUTF8).wx_str(), \ 140 wxString(__FUNCTION__, wxConvUTF8).wx_str(), \ 141 wxString(__FILE__, wxConvUTF8).wx_str(), \ 144 #define CC_LOCKER_TRACK_CS_ENTER(CS) \ 146 THREAD_LOCKER_CS_ENTER(CS); \ 148 THREAD_LOCKER_CS_ENTERED(CS); \ 150 #define CC_LOCKER_TRACK_CS_LEAVE(CS) \ 152 THREAD_LOCKER_CS_LEAVE(CS); \ 155 #elif defined CC_ENABLE_LOCKER_ASSERT 156 #define CC_LOCKER_TRACK_CS_ENTER(CS) CS.Enter(); 157 #define CC_LOCKER_TRACK_CS_LEAVE(CS) CS.Leave(); 159 #define CC_LOCKER_TRACK_TT_MTX_LOCK(M) \ 161 auto result = M.Lock(); \ 162 cbAssert(result==wxMUTEX_NO_ERROR); \ 165 #define CC_LOCKER_TRACK_TT_MTX_UNLOCK(M) \ 167 auto result = M.Unlock(); \ 168 cbAssert(result==wxMUTEX_NO_ERROR); \ 171 #define CC_LOCKER_TRACK_CBBT_MTX_LOCK CC_LOCKER_TRACK_TT_MTX_LOCK 172 #define CC_LOCKER_TRACK_CBBT_MTX_UNLOCK CC_LOCKER_TRACK_TT_MTX_UNLOCK 173 #define CC_LOCKER_TRACK_P_MTX_LOCK CC_LOCKER_TRACK_TT_MTX_LOCK 174 #define CC_LOCKER_TRACK_P_MTX_UNLOCK CC_LOCKER_TRACK_TT_MTX_UNLOCK 176 #define CC_LOCKER_TRACK_CS_ENTER(CS) CS.Enter(); 177 #define CC_LOCKER_TRACK_CS_LEAVE(CS) CS.Leave(); 179 #define CC_LOCKER_TRACK_TT_MTX_LOCK(M) M.Lock(); 180 #define CC_LOCKER_TRACK_TT_MTX_UNLOCK(M) M.Unlock(); 181 #define CC_LOCKER_TRACK_CBBT_MTX_LOCK CC_LOCKER_TRACK_TT_MTX_LOCK 182 #define CC_LOCKER_TRACK_CBBT_MTX_UNLOCK CC_LOCKER_TRACK_TT_MTX_UNLOCK 183 #define CC_LOCKER_TRACK_P_MTX_LOCK CC_LOCKER_TRACK_TT_MTX_LOCK 184 #define CC_LOCKER_TRACK_P_MTX_UNLOCK CC_LOCKER_TRACK_TT_MTX_UNLOCK
const wxString g_DebugTraceFile
Trace file name (if above is enabled).
void Log(const wxString &msg)
static std::unique_ptr< CCLogger > s_Inst
CCLogger(const CCLogger &)
void AddToken(const wxString &msg)
void DebugLog(const wxString &msg)
CCLogger & operator=(const CCLogger &)
bool g_EnableDebugTrace
Toggles tracing into file.
void Init(wxEvtHandler *parent, int logId, int debugLogId, int addTokenId=-1)