How about log levels? The idea is to allow the creation of certain log
destinations to only listen to certain log levels.
For example:
LogLocation* pFile = new LogLocHTML ("MyLog.html");pFile.SetThreshold (LOG_WARNING); // only output warnings/errorsLogSource lout;lout << LogLevel (DEBUG) << "Hi" << std::endl; // will only output to DEBUG streamslout << LogLevel (WARNING) << " *** Some error" << std::endl; //outputs to file
My log manager uses this approch[smile]
For compiling out, you can try using the preprocessor:
#ifdef DEBUGlout << LogLevel (DEBUG) << "Hi" << std::endl; // will only output to DEBUG streams#endif
#define DEBUG for debuig builds, #undef for release. In release builds, the
compilier will not see the above code. It will only compile if DEBUG is
defined.
Alot of compilier IDEs predefine NDEBUG for debug builds. You can use
this method instead, if you like.