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.

46 lines
1.2 KiB
C

2 years ago
#pragma once
// C++ STL headers
#include <string>
#ifdef BUILD_COMMDLL
#define COMMDLL_DLLCLASS __declspec(dllexport)
#else
#define COMMDLL_DLLCLASS __declspec(dllimport)
#endif
class COMMDLL_DLLCLASS CommLog
{
public:
2 years ago
CommLog(const std::string& strConfigIni, const std::string& strSection);
virtual ~CommLog();
2 years ago
2 years ago
inline bool isEnable() { return m_bEnable; }
2 years ago
2 years ago
void setBaseFolder(const std::string& strFolder);
void setSubFolder(const std::string& strSubFolder);
void setFilename(const std::string& strFilename);
bool log(const std::string& strMsg, bool bSend);
bool saveFile(const std::string& strFileName, const std::string& strContent);
std::string readFile(const std::string& strFileName);
2 years ago
private:
2 years ago
inline std::string getFilePath(std::string strFileName = "")
{
if (!m_strFilename.empty())
{
strFileName = m_strFilename;
}
//
return m_strFolder + R"(\)" + m_strSubFolder + R"(\)" + strFileName;
}
std::string m_strConfigIni;
std::string m_strSection;
std::string m_strFolder;
std::string m_strSubFolder;
std::string m_strFilename{};
bool m_bEnable{ false };
2 years ago
};