9.1. Module Structure¶
The logging module provides the following classes:
Logis the core class of the logging module. This singleton is not only in charge of the logging operations (see Logging Messages), but it also provides configuration APIs to set different logging configuration aspects (see Module Configuration), as well as logging filtering at various levels (see Filters). It contains zero or moreLogConsumerobjects. The singleton’s consuming thread feeds the log entries added to the logging queue using the macros defined in Logging Messages to the log consumers sequentially (see Logging Thread).Warning
LogAPI exposes member functionLog::QueueLog(). However, this function is not intended to be used directly. To add messages to the log queue, use the methods described in Logging Messages.LogConsumeris the base class for all the log consumers (see Consumers). It includes the member functions that derived classes should overload to consume log entries.OStreamConsumerderives fromLogConsumer. It defines how to consume log entries for outputting to anstd::ostreamobject. It includes a member function that derived classes must overload to define the desiredstd::ostreamobject.1.
StdoutConsumerderives fromOStreamConsumer. It defines STDOUT as the outputstd::ostreamobject (see StdoutConsumer).2.
StdoutErrConsumerderives fromOStreamConsumer. It defines aLog::Kindthreshold so that if theLog::Kindis equal to or more severe than the selected threshold, the output defined will be STDERR. Otherwise, it defines STDOUT as the output (see StdoutErrConsumer).3.
FileConsumerderives fromOStreamConsumer. It defines an user specified file as the outputstd::ostreamobject (see FileConsumer).
Logging module class diagram¶
The module can be further extended by creating new consumer classes deriving from LogConsumer and/or
OStreamConsumer.
To enable a custom consumer just follow the instructions on Register Consumers.