Logging Subsystem Overview

Logging Subsystem is built up from a set of globally available functions as follows:

logMsg() - Logs a message logDebug() - Logs a message only in Debug build (when NDEBUG isn't defined) logWarning() - Logs a warning message (prepends with "Warning:") logError() - Logs an error message (preprends with "Error:") logFatalError() - Logs a fatal system error and abort()'s the app logTrace() - Logs a message only if the given trace mask is enabled

The logging functions use Log class as backend for various data storage, for example tracemasks, and (in the future) other logging targets besides the standard error device.

Each logging function is duplicated - one version for std::string argument (for usage with literal strings), and second version for boost::format argument (for usage of printf()-style formatting). Thus the following code is a sample usage of this system:

Note - I had to escape few 's for the Doxygen HTML-generation work correctly on this file - you'll get the point.

     static const int LOGTRACE = 1;
     logMsg(boost::format("Hello %s, This is logtest#%d") % "Madcat" % 10);
     logDebug("This is a debug message.");
     logDebug(boost::format("This is %dnd debug message.") % 2);
     logError("And this is a serious error.");
     logError(boost::format("Actually, this one is too. Errorcode: %d") % 5);

     logTrace(LOGTRACE, "This will not be seen.");
     Log::addTraceMask(LOGTRACE, "LogTrace");
     logTrace(LOGTRACE, "This is a Log Trace.");
     logTrace(LOGTRACE, "This will not be seen.");
The output produced by the above code should be:
     Hello Madcat, This is logtest#10
     Debug: This is a debug message.
     Debug: This is 2nd debug message.
     Error: And this is a serious error.
     Error: Actually, this one is too. Errorcode: 5
     Trace(LogTrace): This is a Log Trace.