Main Page   Reference Manual   Namespace List   Compound List   Namespace Members   Compound Members   File Members  

Modules | Classes
Controlling The Output Level (Debug Channels)
Collaboration diagram for Controlling The Output Level (Debug Channels):

Modules

 Predefined Debug Channels
 

Classes

class  libcwd::channel_ct
 This object represents a debug channel, it has a fixed label. A debug channel can be viewed upon as a single bit: on or off. More...
 

Detailed Description


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:

Dout(dc::notice, "Libcwd is a great library");
gives as result
NOTICE: Libcwd is a great library
and
#ifdef CWDEBUG
namespace myapplication {
namespace debug {
namespace channels { // Assuming DEBUGCHANNELS is ::myapplication::debug::channels
namespace dc {
libcwd::channel_ct hello("HELLO");
}
} // namespace DEBUGCHANNELS
}
}
#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.
Copyright © 2001 - 2004 Carlo Wood.  All rights reserved.