12345678910111213141516171819202122232425262728293031323334353637383940 |
- #include "stdafx.h"
- #include "CommunicationLogger.h"
- #include "LogFacade.h"
- using namespace DIOS::Dev::Detail::MachineryECOM;
- CommunicationLogger *CommunicationLogger::m_instance = nullptr;
- CommunicationLogger::CommunicationLogger() :m_logger(nullptr)
- {
- }
- CommunicationLogger::~CommunicationLogger()
- {
- if (m_logger)
- {
- LogFacade::Release(m_logger);
- }
- }
- CommunicationLogger *CommunicationLogger::Instance()
- {
- if (m_instance == nullptr)
- {
- m_instance = new CommunicationLogger();
- }
- return m_instance;
- }
- void CommunicationLogger::Initialize(const std::string &workpath)
- {
- SYSTEMTIME st;
- GetLocalTime(&st);
- char tmp[32] = { 0 };
- sprintf_s(tmp, "A_Communication");
- m_logger = LogFacade::CreateLogger(workpath, tmp);
- }
|