#ifndef LOGGER_HH
#define LOGGER_HH
#include <ClanLib/network.h>
#include <iostream>
/**
* Message severity, WARN and above should go to stderr, INFO and DEBUG to stdout
*
* @see Engine::log
*/
enum LogLevel {
FATAL,
ERROR,
WARN,
INFO,
DEBUG,
};
/**
* Utility class used for logging, use Engine::log to construct these
*
* @see Engine::log
*/
class Logger {
private:
std::ostream &stream;
enum LogLevel level;
const char *module;
public:
Logger (std::ostream &stream, enum LogLevel level, const char *module);
template <typename T> Logger& operator<< (const T val) {
#ifndef NDEBUG
stream << val;
#else
(void) val;
#endif
return *this;
}
~Logger (void);
};
std::ostream& operator<< (std::ostream &s, CL_NetComputer &c);
std::ostream& operator<< (std::ostream &s, CL_NetObject_Server &obj);
std::ostream& operator<< (std::ostream &s, CL_NetObject_Client &obj);
#endif /* LOGGER_HH */