class CDbgLog
You can use the C++ class CDbgLog in order to write debugging information to the UAEDT window.
You can find the CDbgLog class in the application directory in DBGLOGLIBCE.ZIP (which contains the library and the CDbgLog class). This class is distributed as static library with MFC support. This library was created using eMbedded Visual C++ 3.0.
You just have to include the DbgLogInterface.h header file (e.g. in your stdafx.h file). The correct library will be linked automatically.
CDbgLog::CDbgLog(LPCTSTR lpStr);
Writes lpStr to the UAEDT window using the
correct format (e.g. CDbgLog dbg(L"CMyApp::CMyApp()")
--> 'CMyApp::CMyApp() {') for
displaying nested calls.
CDbgLog::~CDbgLog();
Writes the string provided by the ctor to the UAEDT window using the correct
format (e.g. CDbgLog dbg(L"CMyApp::CMyApp()")
--> '} CMyApp::CMyApp()' or '}
CMyApp::CMyApp() (return info)') for
displaying nested calls. See also SetReturn() method.
public methods
void Log(LPCTSTR lpStr);
Writes lpStr to the UAEDT window using the
correct format.
void LogInt(LPCTSTR lpFormat, int n);
Writes the integer value n to the UAEDT window
using the format string lpFormat. (e.g. dbg.Log(L"m_nValue=%02d", m_nValue);)
void SetReturn(LPCTSTR
lpStrRet);
Sets information which is displayed by the dtor. This method has an LPCTSTR
parameter in order to keep generic. (e.g. dbg.SetReturn(L"TRUE");
--> '} CMyApp::CMyApp() (TRUE)').
See also dtor.
public member variables
static bool m_fOutputDebugStringAPI;
Defines if the Log????() methods also should write information via
OutputDebugString() to a debugger. This is useful if you debug your application
with a desktop debugger.
Samples
// CDbgLog, LogInt() sample |
// CDbgLog, SetReturn() sample bool MyFunc() { CDbgLog dbg(L"MyFunc()"); if (!fOK ) { dbg.SetReturn(L"false"); return false; } dbg.SetReturn(L"true"); return true; } |
Remarks
Do not write only CDbgLog(L"MyFunc()")
because this will cause the dtor called immediately. This causes incorrect
display of nested calls of methods or functions. Always use a variable e.g. dbg
as shown in the samples above.