LEFT | RIGHT |
1 #include <fstream> | 1 #include <fstream> |
2 #include <stdio.h> | 2 #include <stdio.h> |
3 #include <sstream> | 3 #include <sstream> |
4 #include <Windows.h> | 4 #include <Windows.h> |
5 | 5 |
6 #include "../shared/Utils.h" | 6 #include "../shared/Utils.h" |
| 7 #include "../shared/CriticalSection.h" |
7 | 8 |
8 #include "Debug.h" | 9 #include "Debug.h" |
9 | 10 |
10 #ifdef _DEBUG | 11 #ifdef _DEBUG |
11 | 12 |
12 CriticalSection debugLock; | 13 namespace |
13 | 14 { |
| 15 CriticalSection debugLock; |
| 16 }; |
14 void Debug(const std::string& text) | 17 void Debug(const std::string& text) |
15 { | 18 { |
16 SYSTEMTIME st; | 19 SYSTEMTIME st; |
17 ::GetSystemTime(&st); | 20 ::GetSystemTime(&st); |
18 | 21 |
19 char timeBuf[14]; | 22 char timeBuf[14]; |
20 _snprintf_s(timeBuf, _TRUNCATE, "%02i:%02i:%02i.%03i", st.wHour, st.wMinute, s
t.wSecond, st.wMilliseconds); | 23 _snprintf_s(timeBuf, _TRUNCATE, "%02i:%02i:%02i.%03i", st.wHour, st.wMinute, s
t.wSecond, st.wMilliseconds); |
21 | 24 |
22 std::wstring filePath = GetAppDataPath() + L"\\debug_engine.txt"; | 25 std::wstring filePath = GetAppDataPath() + L"\\debug_engine.txt"; |
23 | 26 |
(...skipping 12 matching lines...) Expand all Loading... |
36 | 39 |
37 void DebugException(const std::exception& exception) | 40 void DebugException(const std::exception& exception) |
38 { | 41 { |
39 Debug(std::string("An exception occurred: ") + exception.what()); | 42 Debug(std::string("An exception occurred: ") + exception.what()); |
40 } | 43 } |
41 #else | 44 #else |
42 void Debug(const std::string& text) {} | 45 void Debug(const std::string& text) {} |
43 void DebugLastError(const std::string& message) {} | 46 void DebugLastError(const std::string& message) {} |
44 void DebugException(const std::exception& exception) {} | 47 void DebugException(const std::exception& exception) {} |
45 #endif // _DEBUG | 48 #endif // _DEBUG |
LEFT | RIGHT |