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

Writing Debug Output: Introduction
Collaboration diagram for Writing Debug Output: Introduction:


Libcwd is an ostream oriented debug output facility.  The class libcwd::debug_ct represents a single ostream

Libcwd defines and internally uses only one object of that class, called a debug object, being libcwd::libcw_do

Debug output is written using macros (Dout and DoutFatal), both of which are defined to use libcwd::libcw_do.  More general macros exist (LibcwDout and LibcwDoutFatal) that allow you to use a different (custom) debug object.

Dout and DoutFatal take two arguments: the first argument is used to specify debug channels and control flags while the second argument should be a series of objects seperated by << that you want to write to the ostream.

For example,

Dout(dc::notice|blank_label_cf|flush_cf, "Total count: " << count << "; Average: " << average);

In this example dc::notice is one of the predefined debug channels.  Debug channels are intended to control the amount of output of your application: you can switch the channels on and off.

Copyright © 2001 - 2004 Carlo Wood.  All rights reserved.