You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.0 KiB
C++
79 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include <array>
|
|
#include <map>
|
|
|
|
#include "DllDefines.h"
|
|
|
|
#include "LogSettings.h"
|
|
#include "Logger.h"
|
|
|
|
namespace mitech::utils::logging
|
|
{
|
|
enum class eLOGGER
|
|
{
|
|
DEBUG_LOG,
|
|
DEBUG_TIMING_LOG,
|
|
GUI_EVENT_LOG,
|
|
SG_DEBUG_LOG,
|
|
MAX_LOGGER
|
|
};
|
|
|
|
class CLogManager
|
|
{
|
|
public:
|
|
CLogManager();
|
|
virtual ~CLogManager();
|
|
|
|
void Initialize();
|
|
void Shutdown() const;
|
|
|
|
CLogger& GetLogger(eLOGGER eLog) { return *m_mapLogger[eLog]; }
|
|
|
|
private:
|
|
const std::map<eLOGGER, std::string> m_mapLoggerSettingFile{
|
|
{ eLOGGER::DEBUG_LOG, R"(d:\machine\config\debugLogSetting.json)" },
|
|
{ eLOGGER::DEBUG_TIMING_LOG, R"(d:\machine\config\debugLogTimingSetting.json)" },
|
|
{ eLOGGER::GUI_EVENT_LOG, R"(d:\machine\config\guiEventLogSetting.json)" },
|
|
{ eLOGGER::SG_DEBUG_LOG, R"(d:\machine\config\SGDebugLogSetting.json)" }
|
|
};
|
|
|
|
const std::string m_LoggerGlobalSettingFile{ R"(d:\machine\config\GlobalLogSetting.json)" };
|
|
|
|
stLogGlobal m_LoggerGlobalSetting;
|
|
std::map<eLOGGER, stLogOption> m_mapLoggerOption;
|
|
std::map<eLOGGER, std::unique_ptr<CLogger>> m_mapLogger;
|
|
};
|
|
|
|
//
|
|
class UTILITYDLL CLoggerManagerSingleton
|
|
{
|
|
public:
|
|
/*
|
|
* Disable copy constructor and assignment operators
|
|
*/
|
|
class CLoggerManagerSingleton(const CLoggerManagerSingleton&) = delete;
|
|
class CLoggerManagerSingleton& operator=(const CLoggerManagerSingleton&) = delete;
|
|
|
|
// accessor
|
|
static CLoggerManagerSingleton& Instance()
|
|
{
|
|
static CLoggerManagerSingleton _instance;
|
|
|
|
return _instance;
|
|
}
|
|
|
|
CLogManager& LoggerManager()
|
|
{
|
|
return m_loggerManager;
|
|
}
|
|
|
|
private:
|
|
// private ctor
|
|
CLoggerManagerSingleton() = default;
|
|
~CLoggerManagerSingleton() = default;
|
|
|
|
CLogManager m_loggerManager;
|
|
};
|
|
}
|