Created
October 29, 2017 19:52
-
-
Save MatinMN/5c26e0e3d1c1d9acbf4ae1bf4d0de15c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
class Log{ | |
public: | |
const int LogLevelError = 0; | |
const int LogLevelWarning = 1; | |
const int LogLevelInfo = 2; | |
private: | |
int LogLevel = LogLevelInfo; | |
public: | |
void SetLevel(int level) { | |
LogLevel = level; | |
} | |
void Warn(const char* message) { | |
if (LogLevel >= LogLevelWarning) | |
std::cout << "[WARNING]: " << message << std::endl; | |
} | |
void Info(const char* message) { | |
if (LogLevel >= LogLevelInfo) | |
std::cout << "[WARNING]: " << message << std::endl; | |
} | |
void Error(const char* message) { | |
if (LogLevel >= LogLevelError) | |
std::cout << "[WARNING]: " << message << std::endl; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment