Visual Assert – The Unit Testing Add-In for Visual C++
cfix – C/C++ Unit Testing for Win32 and NT




Use CFIX_LOG to log arbitrary information. The macro allows printf-style formatting and variable argument lists. Consult the documentation of printf for a list of format specifiers.

void CFIX_LOG( __in PCTSTR Format, ... );
In C++, it is valid to pass a PCSTR even though UNICODE is defined and PCWSTR if UNICODE is not defined. Additionally, the following overloads exist:
void CFIX_LOG( __in std::string Message );
void CFIX_LOG( __in std::wstring Message );

If UNICODE has been defined, string parameters are expected to by of type PCWSTR. Otherwise, ANSI is assumed and string parameters are expected to by of type PCSTR.


In kernel mode, ANSI strings are not supported. Strings are always assumed to by of type PCWSTR. Moreover, formatting can only take place at IRQL <= APC_LEVEL. At higher IRQL, formatting is skipped and the Format string is used as-is.

Usage example
CFIX_LOG( L"A simple log message" );
CFIX_LOG( L"Value is %x, Last error was: %d", foo, GetLastError() );

Table 7.11. 

 User ModeKernel Mode
Available since1.01.1
HeaderDeclared in cfix.hDeclared in cfix.h
LibraryLink to cfix.libLink to cfixkdrv.lib
IRQLN/ACallable at any IRQL