jwbuurlage/Motor — pull request #2 by nitrix (2012-01-04 06:26:00+00:00)
Title: A much better Logger

You use it like this:

LOG_DEBUG("Calling Class::function()...");
LOG_ERROR("OpenGL crashed with error" << err);
LOG_INFO("You name is " << first_name << " " << last_name);

For now it doesn't log anything to a file, but you could easily adapt the class for it.
(*Logger::flush() is called everytime Logger::m_stream buffer have the entire data to print/save.*)

By default, the logger will print everything but you can configure what error types you want using flags.
Let's say you want to print only warnings and errors:

LOG_SET_LEVEL(Logger:WARNING | ERROR);

Possible flags are:

* Logger::DEBUG
* Logger::INFO
* Logger::WARNING
* Logger::ERROR

and again you use them through macros respectively like so:

LOG_ERROR(), LOG_INFO(), LOG_WARNING(), LOG_ERROR().

This allow us to change the Logger later while behind way easier for the programmer to use.