ES-DE/es-core/src/Log.h
pjft c150d63d54 Backup previous session's Log file
Always keeps one session’s log backup file.
2017-08-01 14:31:06 +01:00

40 lines
695 B
C++

#ifndef _LOG_H_
#define _LOG_H_
#define LOG(level) \
if(level > Log::getReportingLevel()) ; \
else Log().get(level)
#include <string>
#include <sstream>
#include <iostream>
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 init();
static void open();
static void close();
protected:
std::ostringstream os;
static FILE* file;
private:
static LogLevel reportingLevel;
static FILE* getOutput();
LogLevel messageLevel;
};
#endif