mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-23 06:35:38 +00:00
37 lines
633 B
C
37 lines
633 B
C
|
#ifndef _LOG_H_
|
||
|
#define _LOG_H_
|
||
|
|
||
|
#define LOG(level) \
|
||
|
if(level > Log::getReportingLevel()) ; \
|
||
|
else Log().get(level)
|
||
|
|
||
|
#include <string>
|
||
|
#include <sstream>
|
||
|
|
||
|
enum LogLevel { LogError, LogWarning, LogInfo, LogDebug };
|
||
|
|
||
|
class Log
|
||
|
{
|
||
|
public:
|
||
|
//Log();
|
||
|
~Log();
|
||
|
std::ostringstream& get(LogLevel level = LogInfo);
|
||
|
|
||
|
static LogLevel getReportingLevel();
|
||
|
static void setReportingLevel(LogLevel level);
|
||
|
|
||
|
static std::string getLogPath();
|
||
|
|
||
|
static void flush();
|
||
|
static void close();
|
||
|
protected:
|
||
|
std::ostringstream os;
|
||
|
static FILE* file;
|
||
|
private:
|
||
|
static LogLevel reportingLevel;
|
||
|
static FILE* getOutput();
|
||
|
LogLevel messageLevel;
|
||
|
};
|
||
|
|
||
|
#endif
|