diff --git a/dll/commdll.dll b/dll/commdll.dll index ae44bfe..2511c30 100644 Binary files a/dll/commdll.dll and b/dll/commdll.dll differ diff --git a/dll/commdllD.dll b/dll/commdllD.dll index 3e071da..5dd89e7 100644 Binary files a/dll/commdllD.dll and b/dll/commdllD.dll differ diff --git a/dll/iodll.dll b/dll/iodll.dll index 1d6e5c8..261ef5f 100644 Binary files a/dll/iodll.dll and b/dll/iodll.dll differ diff --git a/dll/iodllD.dll b/dll/iodllD.dll index 58d98d0..acaaee5 100644 Binary files a/dll/iodllD.dll and b/dll/iodllD.dll differ diff --git a/dll/mcctrdll.dll b/dll/mcctrdll.dll index ddc4d84..118ef88 100644 Binary files a/dll/mcctrdll.dll and b/dll/mcctrdll.dll differ diff --git a/dll/mcctrdllD.dll b/dll/mcctrdllD.dll index a02a9e8..6cbf11d 100644 Binary files a/dll/mcctrdllD.dll and b/dll/mcctrdllD.dll differ diff --git a/dll/secsgemdll.dll b/dll/secsgemdll.dll index 6d168c8..951fc82 100644 Binary files a/dll/secsgemdll.dll and b/dll/secsgemdll.dll differ diff --git a/dll/secsgemdllD.dll b/dll/secsgemdllD.dll index 16866f4..cc3fe59 100644 Binary files a/dll/secsgemdllD.dll and b/dll/secsgemdllD.dll differ diff --git a/dll/utility.dll b/dll/utility.dll index 8312687..6110305 100644 Binary files a/dll/utility.dll and b/dll/utility.dll differ diff --git a/dll/utilityD.dll b/dll/utilityD.dll index acc4cf4..28ed542 100644 Binary files a/dll/utilityD.dll and b/dll/utilityD.dll differ diff --git a/secsgemdll/Include/SGManager.h b/secsgemdll/Include/SGManager.h index 160e451..a20a8cb 100644 --- a/secsgemdll/Include/SGManager.h +++ b/secsgemdll/Include/SGManager.h @@ -1,7 +1,7 @@ #pragma once // STL -#include +#include #include #include #include @@ -11,7 +11,6 @@ // project #include "ISGManager.h" #include "BufferedSocket.h" -#include "SGLogger.h" #define MAXSOCKBUF 4096 @@ -186,6 +185,8 @@ protected: virtual void NotifyHandler(WPARAM wParam, LPARAM lParam); private: + void InitCommandMap(); + /************************** private methods *************************/ bool static SkipToNextData(char** ppStr); std::string GetNextData(char** ppStr); @@ -205,7 +206,7 @@ private: "SCHEDULE" }; - const std::map m_vecMainModes{ + const std::unordered_map m_vecMainModes{ { "NOMATERIAL", NOMATERIAL_MODE }, { "PRODUCTION", PRODUCTION_MODE }, { "ENGINEERING", ENGINEERING_MODE }, @@ -220,6 +221,9 @@ private: "SUPER USER" }; + using CommandHandler = std::function; + std::unordered_map m_commandMap; + /************************** private fields **************************/ int m_nSGPort{ 2000 }; std::string m_strSGIpAddress; @@ -245,7 +249,6 @@ private: std::string m_sGeneralCmdReceived; std::string m_sSecsGemDataFile; - CSGLogger m_logger; std::unique_ptr m_pSocketSecsGem; }; diff --git a/utility/Include/DebugLog.h b/utility/Include/DebugLog.h index cb98b18..88041c1 100644 --- a/utility/Include/DebugLog.h +++ b/utility/Include/DebugLog.h @@ -80,6 +80,24 @@ void GUIEventLog(fmt::format_string _fmt, Args&&... args) CLoggerManagerSingleton::Instance().LoggerManager().GetLogger(eLOGGER::GUI_EVENT_LOG).Log(_fmt, args...); } +template +void SGDebugLog(fmt::format_string _fmt, Args&&... args) +{ + CLoggerManagerSingleton::Instance().LoggerManager().GetLogger(eLOGGER::SG_DEBUG_LOG).Log(_fmt, args...); +} + +template +void SGDebugLogError(fmt::format_string _fmt, Args&&... args) +{ + CLoggerManagerSingleton::Instance().LoggerManager().GetLogger(eLOGGER::SG_DEBUG_LOG).Error(_fmt, args...); +} + +template +void SGDebugLogInfo(fmt::format_string _fmt, Args&&... args) +{ + CLoggerManagerSingleton::Instance().LoggerManager().GetLogger(eLOGGER::SG_DEBUG_LOG).Info(_fmt, args...); +} + std::shared_ptr UTILITYDLL GetLogger(const std::string& strName); // on demand flush to file @@ -89,6 +107,7 @@ void UTILITYDLL FlushDebugLogTiming(); void UTILITYDLL FlushGuiEventLog(); +void UTILITYDLL FlushSGDebugLog(); // void UTILITYDLL ShutdownLogging(); @@ -103,4 +122,7 @@ bool UTILITYDLL IsDebugLogTimingStarted(); // All GUI Activities Events Log void UTILITYDLL StartGUIEventLog(); -void UTILITYDLL StopGUIEventLog(); \ No newline at end of file +void UTILITYDLL StopGUIEventLog(); + +void UTILITYDLL StartSGDebugLog(); +void UTILITYDLL StopSGDebugLog(); \ No newline at end of file diff --git a/utility/Include/LogManager.h b/utility/Include/LogManager.h index 95d96f2..b6ea3b2 100644 --- a/utility/Include/LogManager.h +++ b/utility/Include/LogManager.h @@ -15,6 +15,7 @@ namespace mitech::utils::logging DEBUG_LOG, DEBUG_TIMING_LOG, GUI_EVENT_LOG, + SG_DEBUG_LOG, MAX_LOGGER }; @@ -33,7 +34,8 @@ namespace mitech::utils::logging const std::map 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::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)" }; diff --git a/utility/Include/MitechSGDebugLog.h b/utility/Include/MitechSGDebugLog.h new file mode 100644 index 0000000..83c6297 --- /dev/null +++ b/utility/Include/MitechSGDebugLog.h @@ -0,0 +1,33 @@ +#pragma once + +#include +#include + +#include "spdlog/spdlog.h" + +#include "Logger.h" +#include "LogSettings.h" + +namespace mitech::utils::logging +{ + class CMitechSGDebugLog : public CLogger + { + public: + explicit CMitechSGDebugLog(const std::string& strName, const stLogOption& mySetting); + ~CMitechSGDebugLog() final; + + private: + void InitLogger(const stLogOption& mySetting); + + // Inherited via CLogger + void DoStart() override; + void DoFlush() override; + void DoLogging(const std::string& strMsg) override; + void DoTrace(const std::string& strMsg) override; + void DoInfo(const std::string& strMsg) override; + void DoError(const std::string& strMsg) override; + + std::shared_ptr m_logger; + std::string m_strPathFilename{ R"(d:\machine\log\SGDebugLog.log)" }; + }; +} \ No newline at end of file diff --git a/utility/lib/utility.lib b/utility/lib/utility.lib index 3c852b9..8dc6378 100644 Binary files a/utility/lib/utility.lib and b/utility/lib/utility.lib differ diff --git a/utility/lib/utilityD.lib b/utility/lib/utilityD.lib index edbd813..0fc8aad 100644 Binary files a/utility/lib/utilityD.lib and b/utility/lib/utilityD.lib differ