OutputDebugString().
The way I write and debug programs is to have lots and lots of debugging output. I prefer to have too many debug messages than too few. That way, I am sure to not miss anything. By having lots of debug output, you can see how a program really works as opposed to how you think a program works. I like having twenty pages of debugging output to sift through so I can see my bugs and the context they present themselves.
static int Indent
static DWORD Levels
static BOOL Tracing
CWfcTrace( const CString& function_name, DWORD tracing_level )
static void TraceAllOn( void )
static void TraceAllOff( void )
static void TraceLevelOn( DWORD level )
static void TraceLevelOff( DWORD level )
static void TraceOn( void )
static void TraceOff( void )
void Output( const CString& message ) const void Output( const CString& message, const int integer ) const void Output( const CString& message, const UINT integer ) const void Output( const CString& message, const long a_long ) const void Output( const CString& message, const ULONG a_long ) const void Output( const CString& message, const LONGLONG a_long ) const void Output( const CString& message, const ULONGLONG a_long ) const void Output( const CString& message, const double a_double ) const void Output( const CString& message, const CString& string ) const void Output( const CString& message, const CObject * object ) const void Output( const CString& message, const VOID * pointer ) const void Output( const CString& message, const CObject& object ) const void Output( const CString& message, const LARGE_INTEGER& value ) const void Output( const CString& message, const ULARGE_INTEGER& value ) const void Output( const CString& message, const RECT& value ) const void Output( const CString& message, const POINT& value ) const void Output( const CString& message, const SIZE& value ) const void Output( const CString& message, const GUID& value ) const void Output( const CString& message, const FILETIME& value ) const void Output( const CString& message, const SYSTEMTIME& value ) const
WNDCLASS)
but once you start down that road, you get very little return on investment.
So, I stuck with the basic data types.
void OutputBinary( const CString& message, const ULONG a_long ) const
ULONG as
bits. This is great for picking apart bit masks.
void OutputVariant( const CString& message, const VARIANT& value ) const void OutputVariant( const CString& message, const VARIANT * value ) const
VARIANT.
void ReportError( DWORD error_code )
void ReportSocketError( DWORD error_code )
#include <wfc.h>
void print_message( void )
{
WFCTRACEINIT( TEXT( "print_message()" ) );
WFCTRACEVAL( TEXT( "Test number " ), 1 );
}
void main( void )
{
WFCTRACEINIT( TEXT( "main()" ) );
print_message();
}
Will produce this output:
Entering main()
Entering print_message()
print_message() : Test number 1
Leaving print_message()
Leaving main()