mirror of
https://github.com/fadden/ciderpress.git
synced 2024-11-22 05:31:24 +00:00
Disable logging in non-debug builds
Ideally there would be a preference that allowed you to enable logging and specify the file's location. That could make remote debugging of certain problems easier.
This commit is contained in:
parent
5498a4e835
commit
a250f6d89a
@ -18,7 +18,7 @@
|
|||||||
MyApp gMyApp;
|
MyApp gMyApp;
|
||||||
|
|
||||||
/* used for debug logging */
|
/* used for debug logging */
|
||||||
DebugLog* gDebugLog;
|
DebugLog* gDebugLog = NULL;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -27,7 +27,10 @@ DebugLog* gDebugLog;
|
|||||||
*/
|
*/
|
||||||
MyApp::MyApp() : CWinAppEx()
|
MyApp::MyApp() : CWinAppEx()
|
||||||
{
|
{
|
||||||
|
#ifdef _DEBUG
|
||||||
|
// TODO: make this a setting, rather than a debug-build-only feature
|
||||||
gDebugLog = new DebugLog(L"C:\\src\\cplog.txt");
|
gDebugLog = new DebugLog(L"C:\\src\\cplog.txt");
|
||||||
|
#endif
|
||||||
|
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
|
|
||||||
@ -35,12 +38,14 @@ MyApp::MyApp() : CWinAppEx()
|
|||||||
kAppMajorVersion, kAppMinorVersion, kAppBugVersion,
|
kAppMajorVersion, kAppMinorVersion, kAppBugVersion,
|
||||||
kAppDevString, ctime(&now));
|
kAppDevString, ctime(&now));
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
int tmpDbgFlag;
|
int tmpDbgFlag;
|
||||||
// enable memory leak detection
|
// enable memory leak detection
|
||||||
tmpDbgFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
|
tmpDbgFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
|
||||||
tmpDbgFlag |= _CRTDBG_LEAK_CHECK_DF;
|
tmpDbgFlag |= _CRTDBG_LEAK_CHECK_DF;
|
||||||
_CrtSetDbgFlag(tmpDbgFlag);
|
_CrtSetDbgFlag(tmpDbgFlag);
|
||||||
LOGI("Leak detection enabled");
|
LOGI("Leak detection enabled");
|
||||||
|
#endif
|
||||||
|
|
||||||
EnableHtmlHelp();
|
EnableHtmlHelp();
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,11 @@ extern DebugLog* gDebugLog; // declare and allocate in app
|
|||||||
|
|
||||||
/* send the message to the log file (if open) and the CRT debug mechanism */
|
/* send the message to the log file (if open) and the CRT debug mechanism */
|
||||||
#define LOG_BASE(severity, file, line, format, ...) \
|
#define LOG_BASE(severity, file, line, format, ...) \
|
||||||
{ gDebugLog->Log((severity), (file), (line), (format), __VA_ARGS__); }
|
{ \
|
||||||
|
if (gDebugLog != NULL) { \
|
||||||
|
gDebugLog->Log((severity), (file), (line), (format), __VA_ARGS__); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Log macros, with priority specifier. The output will be written to the
|
* Log macros, with priority specifier. The output will be written to the
|
||||||
|
Loading…
Reference in New Issue
Block a user