#ifndef LOGGER_H #define LOGGER_H #include "utils/StringBuffer.h" namespace Logger { enum Level { NONE, ERROR, WARNING, INFO, DEBUG }; extern Level level; template void error(const StringBuffer& s) { #if LOG_LEVEL >= 1 if(level >= ERROR) { std::cout << "\33[1;31m[ERROR] " << s << "\33[39;49m\n"; } #else (void)s; #endif } template void warn(const StringBuffer& s) { #if LOG_LEVEL >= 2 if(level >= WARNING) { std::cout << "\33[1;33m[WARNING] " << s << "\33[39;49m\n"; } #else (void)s; #endif } template void info(const StringBuffer& s) { #if LOG_LEVEL >= 3 if(level >= INFO) { std::cout << "\33[1;37m[INFO] " << s << "\33[39;49m\n"; } #else (void)s; #endif } template void debug(const StringBuffer& s) { #if LOG_LEVEL >= 4 if(level >= DEBUG) { std::cout << "\33[1;32m[DEBUG] " << s << "\33[39;49m\n"; } #else (void)s; #endif } } #endif