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:
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.");
gives as result
HELLO : Hello World!
KERNEL: This is written when either the kernel or io channel is turned on.