Detailed Description
Whenever debug output is written, one or more
debug channels must be specified. The debug output is then written to the ostream of the debug object unless the debug object is turned off or when all specified
debug channels are off. Each
debug channel can be turned
on and
off independently. Libcwd has defined six
debug channels in namespace
channels::dc (See
Predefined Debug Channels). New
debug channels can be defined by the user, which is as simple as creating a new
channel_ct object.Example,
namespace dc {
channel_ct mychan("MYLABEL");
}
This declaration must be inside the namespace
DEBUGCHANNELS.Multiple
debug channels can be given by using
operator|
between the channel names. This shouldn't be read as ‘or’ but merely be seen as the bit-wise OR operation on the bit-masks that these channels actually represent.
- See also
- Control Flags
Example:
#define Dout(cntrl, data)
Macro for writing debug output.
Definition: debug.h:154
channel_ct notice
Definition: debug.cc:460
gives as result
NOTICE: Libcwd is a great library
and
#ifdef CWDEBUG
namespace myapplication {
namespace channels {
namespace dc {
}
}
}
}
#endif
Dout(dc::hello,
"Hello World!");
Dout(dc::kernel|dc::io,
"This is written when either the dc::kernel "
"or dc::io channel is turned on.");
This object represents a debug channel, it has a fixed label. A debug channel can be viewed upon as a...
Definition: class_channel.h:82
channel_ct debug
Definition: debug.cc:453
gives as result
HELLO : Hello World!
KERNEL: This is written when either the kernel or io channel is turned on.