ciderpress/mdc/mdc.cpp
Andy McFadden f6647b9978 Convert WSMG to LOG
Mostly a bulk conversion of debug messages, primarily with sed:

 sed -e 's/\(WMSG[0-9]\)\(.*\)\(\\n"\)/LOGI\2"/'

This removes the '\n' from the end of the log messages, and sets
them all to "info" severity.

We want to prefix each line with file/line and/or a timestamp,
so it doesn't make sense to have a partial line, and there's no
value in embedding the '\n' in every string.
2014-11-18 14:16:35 -08:00

65 lines
1.4 KiB
C++

/*
* CiderPress
* Copyright (C) 2007 by faddenSoft, LLC. All Rights Reserved.
* See the file LICENSE for distribution terms.
*/
/*
* The application object.
*/
#include "stdafx.h"
#include "mdc.h"
#include "Main.h"
#include <process.h>
/* magic global that MFC finds (or that finds MFC) */
MyApp gMyApp;
DebugLog* gDebugLog;
/*
* Constructor. This is the closest thing to "main" that we have, but we
* should wait for InitInstance for most things.
*/
MyApp::MyApp(LPCTSTR lpszAppName) : CWinApp(lpszAppName)
{
// TODO: make the log file configurable
gDebugLog = new DebugLog(L"C:\\src\\mdclog.txt");
time_t now = time(NULL);
LOGI("MDC v%d.%d.%d started at %.24hs",
kAppMajorVersion, kAppMinorVersion, kAppBugVersion,
ctime(&now));
int tmpDbgFlag;
// enable memory leak detection
tmpDbgFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
tmpDbgFlag |= _CRTDBG_LEAK_CHECK_DF;
_CrtSetDbgFlag(tmpDbgFlag);
LOGI("Leak detection enabled");
}
/*
* This is the last point of control we have.
*/
MyApp::~MyApp(void)
{
LOGI("MDC SHUTTING DOWN");
delete gDebugLog;
}
/*
* It all begins here.
*
* Create a main window.
*/
BOOL
MyApp::InitInstance(void)
{
m_pMainWnd = new MainWindow;
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}