libcwdversion 2.0.0
The C++ Debugging Support Library
Loading...
Searching...
No Matches
Special Functions And Utilities

Miscellaneous helper functions and macros for debug output. More...

Classes

class  libcwd::buf2str
 Print a (char) buffer with a given size to a debug ostream, escaping non-printable characters. More...
class  libcwd::char2str
 Print a char to a debug ostream, escaping non-printable characters as needed. More...

Macros

#define ForAllDebugChannels(...)
 Looping over all debug channels.
#define ForAllDebugObjects(...)
 Looping over all debug objects.

Functions

Channellibcwd::find_channel (char const *label)
 Find debug channel with label label.
void libcwd::list_channels_on (DebugObject &debug_object)
 List all debug channels to a given debug object.

Detailed Description

The generated API reference documents miscellaneous functions and utility macros used with libcwd debug output.

Macro Definition Documentation

◆ ForAllDebugChannels

#define ForAllDebugChannels ( ...)
Value:
LibcwdForAllDebugChannels(LIBCWD_DEBUG_CHANNELS, __VA_ARGS__)
#define LIBCWD_DEBUG_CHANNELS
The namespace containing the current debug channels (dc) namespace.
Definition cwds_debug.h:57

The macro ForAllDebugChannels allows you to run over all debug channels.

For example,

ForAllDebugChannels(while (!debugChannel.is_on()) debugChannel.on());
#define ForAllDebugChannels(...)
Looping over all debug channels.
Definition debug.h:144

which turns all channels on. And

ForAllDebugChannels(if (debugChannel.is_on()) debugChannel.off());

which turns all channels off.

◆ ForAllDebugObjects

#define ForAllDebugObjects ( ...)
Value:
LibcwdForAllDebugObjects(LIBCWD_DEBUG_CHANNELS, __VA_ARGS__)

The macro ForAllDebugObjects allows you to run over all debug objects.

For example,

ForAllDebugObjects(debugObject.set_ostream(&std::cerr, &cerr_mutex));
#define ForAllDebugObjects(...)
Looping over all debug objects.
Definition debug.h:162

would set the output stream of all debug objects to std::cerr.

Function Documentation

◆ find_channel()

Channel * libcwd::find_channel ( char const * label)
Returns
A pointer to the debug channel object whose name starts with label. If there is more than one such debug channel, the object with the lexicographically largest name is returned. When no debug channel could be found, NULL is returned.

◆ list_channels_on()

void libcwd::list_channels_on ( DebugObject & debug_object)

Example:

Dout(list_channels_on(libcw_do)); // libcw_do is the (default) debug object of libcwd.
#define Dout(cntrl,...)
Macro for writing debug output.
Definition debug.h:97
void list_channels_on(DebugObject &debug_object)
List all debug channels to a given debug object.
Definition debug.cxx:1355
DebugObject libcw_do
The default debug object.
Definition debug.cxx:222

Example of output:

   DEBUG   : Disabled
   NOTICE  : Enabled
   WARNING : Enabled
   SYSTEM  : Enabled
   LLISTS  : Disabled
   KERNEL  : Disabled
   IO      : Disabled
   FOO     : Enabled
   BAR     : Enabled

Where FOO and BAR are user defined channels in this example.

References libcwd::Channel::get_label(), libcwd::Channel::is_on(), and noprefix_cf.