Class CPBLogger

C and C++ API Overview, What’s a Log Message, Samples

The primary purpose of the CPBLogger class is to provide tighter control over the usage of components, contexts, and exclusion or enable flags by bundling them all into one object with a Log method. It is most useful where an application has highly segregated logging that is operated on in a very independent fashion. In these cases it is more efficient to control logging by using different CPBLogger objects for different sections of code. In this manner, logging can be very tightly and independently controlled by simply modifying a handful of globally accessible CPBLogger objects.

For example, the CPBLogger class has its own flags for selectively enabling and disabling specific message types or the entire object. These are over and above the identically behaving flags in the components and contexts. This allows prefiltering and enabling control on a per object basis even when multiple objects may be using the same component or context. Note that this also means message creation must pass flags on three objects– not just the usual two.

Class members

CPBLogger  Constructs a CPBLogger object.

Log  Logs a message with the components, contexts, and flags set in the object.

WLog  Logs a message with the components, contexts, and flags set in the object using internationalizable string ids.

SetExclude  Sets the logger’s exclusion flags for prefiltering log messages.

Enable  Enables or disables all logging under this object.