uLib  User mode C/C++ extended API library for Win32 programmers.
Debug.h File Reference

Debug and error handling support. More...

#include <uLib/Common.h>

Go to the source code of this file.

Detailed Description

Debug and error handling support.

License: NNOSL Open source license (See Common.h)

Definition in file Debug.h.

Macros

#define _F(s)   _T("[") _T(__FUNCTION__) _T("] ") _T(s)
 
#define DP_DISABLE   -1
 
#define DP_ALWAYS   0
 
#define DP_FATAL   1
 
#define DP_SEVERE   2
 
#define DP_ERROR   3
 
#define DP_WARNING   4
 
#define DP_INFO   5
 
#define DP_DEBUG   6
 
#define DP_VERBOSE   7
 
#define DP_EXTREME   8
 
#define DP_StdFailMsg(What)   DPrint( DP_ERROR, What _T(" failed: %s\n"), SysErrorMsg() )
 
#define _BREAK   __asm Int 3 /* The original, circa 1996? */
 
#define BREAK_IF(cond)   if (cond) _BREAK
 
#define BREAK()
 
#define DBGBREAK(Msg)   OutputDebugString( Msg ); BREAK()
 
#define TRACE(_lvl, ...)   DPrint(_lvl,__VA_ARGS__)
 
#define _TRACE(_va_)   DPrint##_va_
 
#define TRACEX(_lvl, _fmt, ...)   DPrint(_lvl,_F(_fmt" (%s:%u)\n"),__VA_ARGS__,__FILE__,__LINE__)
 
#define TRACE_IF(cond, ...)   if (cond) DPrint( __VA_ARGS__ )
 
#define TRACEX_IF(_cond, _lvl, _fmt, ...)   if (_cond) DPrint(_lvl,_fmt" (%s:%u)\n",__VA_ARGS__,__FILE__,__LINE__)
 
#define ERROR_TRACE(What)   DP_StdFailMsg( What )
 
#define IF_DEBUG(code)   code
 

Functions

void __cdecl DPrint (int Level, CSTR Fmt,...)
 
CSTR SysErrorMsg (DWORD Err=0, TSTR Buf=NULL, UINT Length=0)
 
CSTR NtErrorMsg (NTSTATUS Status=0, TSTR Buf=NULL, UINT Size=0)
 
bool SetLastErrorFromNtStatus (NTSTATUS Status)
 
ACSTR GetWinMsgName (WORD msgId)
 
ACSTR GetExceptionName (DWORD xCode)
 
int SetDebugLevel (int Level)
 
HANDLE OpenLogFile (CSTR Name, bool Append)
 
CSTR DefaultLogFileName (HMODULE hModule)
 

Variables

CSTR dbg_Name
 
int dbg_Level
 
HANDLE dbg_LogFile
 
bool dbg_Flush