adam4813/Sigma — pull request #136 by Zardoz89 (2014-01-13 16:17:28+00:00)
Title: Added a Logger to Sigma, that can outputs to std::cout or any other ...

...output stream. Also there a little addition in CMakeFileLists.txt to allow to generate a executable for each one .cpp file in src/tests/

This should unify all output stuff and avoid something like It's said in Issue #93

An example of usage :

int main () {
std::ofstream f("log.txt", std::ios::app);
Log::Init(f);
...
LOG_DEBUG << "Hello world!"; // Appends to log.txt -> [DEBUG] Hello world!
LOG << "Hello world!"; // [INFO] Hello world!
LOG_WARN << "Hello world!"; // [WARNING] Hello world!
LOG_ERROR << "Hello world!"; // [ERROR] Hello world!
...
Log::Level(Log::LogLevel::WARN); // Change filtering level
LOG_DEBUG << "Hello world! 2"; // This is not logged
LOG << "Hello world! 2"; // Idem
LOG_WARN << "Hello world! 2"; // But this yes as <= that the Log Level
LOG_ERROR << "Hello world! 2"; // Idem
...
} // RAII closes the log.txt file