Initial test bootstrap.
This commit is contained in:
parent
6c618749f1
commit
4b308f6c32
94 changed files with 2543 additions and 681 deletions
|
@ -1,33 +1,21 @@
|
|||
#pragma once
|
||||
|
||||
#define MLOG_ALL(msg, level) {std::ostringstream mt_logstream;\
|
||||
#define MLOG_ALL(msg, level) {String 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>
|
||||
#include "Pointer.h"
|
||||
#include "String.h"
|
||||
|
||||
class FileLogger
|
||||
{
|
||||
FileLogger()
|
||||
:mWorkDirectory(),
|
||||
mFileName("MT_Log.txt"),
|
||||
mFileStream()
|
||||
{
|
||||
|
||||
}
|
||||
FileLogger();
|
||||
|
||||
public:
|
||||
static FileLogger& GetInstance()
|
||||
{
|
||||
static FileLogger instance;
|
||||
return instance;
|
||||
}
|
||||
static FileLogger& GetInstance();
|
||||
|
||||
FileLogger(FileLogger const&) = delete;
|
||||
void operator=(FileLogger const&) = delete;
|
||||
|
@ -36,22 +24,19 @@ public:
|
|||
|
||||
void disable();
|
||||
|
||||
void SetWorkDirectory(const std::string& workDir);
|
||||
void SetWorkDirectory(const String& workDir);
|
||||
|
||||
void SetFileName(const std::string& fileName);
|
||||
void SetFileName(const String& fileName);
|
||||
|
||||
void Open();
|
||||
|
||||
void Close();
|
||||
|
||||
void LogLine(const std::ostringstream& line);
|
||||
void LogLine(const String& line);
|
||||
|
||||
void LogLine(const std::string& logType, const std::ostringstream& line, const std::string& fileName = "", const std::string& functionName = "", int lineNumber=-1);
|
||||
void LogLine(const String& logType, const String& line, const String& fileName = "", const String& functionName = "", int lineNumber=-1);
|
||||
private:
|
||||
bool mDisabled{false};
|
||||
std::string mWorkDirectory;
|
||||
std::string mFileName;
|
||||
std::ofstream mFileStream;
|
||||
};
|
||||
|
||||
using FileLoggerPtr = std::shared_ptr<FileLogger>;
|
||||
String mWorkDirectory;
|
||||
String mFileName;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue