Clean project structure.
This commit is contained in:
parent
78a4fa99ff
commit
947bf937fd
496 changed files with 206 additions and 137 deletions
|
@ -1,57 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#define MLOG_ALL(msg, level) {std::ostringstream mt_logstream;\
|
||||
mt_logstream << msg; \
|
||||
FileLogger::GetInstance().LogLine(level, mt_logstream, __FILE__, __FUNCTION__, __LINE__);};
|
||||
|
||||
#define MLOG_INFO(msg) MLOG_ALL(msg, "Info");
|
||||
#define MLOG_ERROR(msg) MLOG_ALL(msg, "Error");
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
class FileLogger
|
||||
{
|
||||
FileLogger()
|
||||
:mWorkDirectory(),
|
||||
mFileName("MT_Log.txt"),
|
||||
mFileStream()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public:
|
||||
static FileLogger& GetInstance()
|
||||
{
|
||||
static FileLogger instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
FileLogger(FileLogger const&) = delete;
|
||||
void operator=(FileLogger const&) = delete;
|
||||
|
||||
~FileLogger();
|
||||
|
||||
void disable();
|
||||
|
||||
void SetWorkDirectory(const std::string& workDir);
|
||||
|
||||
void SetFileName(const std::string& fileName);
|
||||
|
||||
void Open();
|
||||
|
||||
void Close();
|
||||
|
||||
void LogLine(const std::ostringstream& line);
|
||||
|
||||
void LogLine(const std::string& logType, const std::ostringstream& line, const std::string& fileName = "", const std::string& functionName = "", int lineNumber=-1);
|
||||
private:
|
||||
bool mDisabled{false};
|
||||
std::string mWorkDirectory;
|
||||
std::string mFileName;
|
||||
std::ofstream mFileStream;
|
||||
};
|
||||
|
||||
using FileLoggerPtr = std::shared_ptr<FileLogger>;
|
Loading…
Add table
Add a link
Reference in a new issue