libcwdversion 2.0.0
The C++ Debugging Support Library
Loading...
Searching...
No Matches

How to create additional debug objects, for writing to more than one ostream.

Each debug object is associated with one ostream. The default debug output macros Dout and DoutFatal use the default debug object libcwd::libcw_do. Other debug objects may be created as global objects; it is convenient to define new macros for each (custom) debug object using the generic macros LibcwDout and LibcwDoutFatal.

For example, add something like the following to your own "debug.h" file:

#ifdef CWDEBUG
extern libcwd::DebugObject my_debug_object;
#define MyDout(cntrl, ...) LibcwDout(LIBCWD_DEBUG_CHANNELS, my_debug_object, cntrl, __VA_ARGS__)
#define MyDoutFatal(cntrl, ...) LibcwDoutFatal(LIBCWD_DEBUG_CHANNELS, my_debug_object, cntrl, __VA_ARGS__)
#else // !CWDEBUG
#define MyDout(a, ...)
#define MyDoutFatal(a, ...) LibcwDoutFatal(std,, a, __VA_ARGS__)
#endif // !CWDEBUG
The Debug Object class, this object represents one output device (ostream).
Definition DebugObject.h:110
See also
libcwd::libcw_do