C++客户端开发接口库 V5.1.8.15
连接信创集成中间件服务程序的二次开发接口
载入中...
搜索中...
未找到
RDMSLogHelper.h
1#pragma once
2
3#include <vector>
4#include <string>
5#include <chrono>
6#include <thread>
7#include <mutex>
8#include <atomic>
9#include <memory>
10#include <condition_variable>
11#include "mdwclient_global.h"
12
13namespace mdwc
14{
16 struct RDMS_LOG
17 {
19 std::string type;
21 bool bError;
23 int color;
25 std::chrono::system_clock::time_point time;
27 std::string context;
28 };
29
31 class MDWC_COMPLILE CRDMSLogHelper
32 {
33 private:
35 std::string m_sProductName;
37 std::string m_sProductVersion;
39 std::vector<RDMS_LOG> m_lstRDMSLogs;
40 //std::mutex m_mtxLogs;
42 std::mutex m_mtxEvent;
43 std::condition_variable m_cvLogEvent;
45 std::atomic<bool> m_bSaveStart;
47 std::thread* m_ThreadSave;
49 std::string m_sLocalIP;
51 std::string m_sMidClientID;
53 std::string m_sUserName;
55 int m_iRegisterTick;
57 std::string m_sRegisterPara;
59 int64_t m_LastUpdateStatusTime;
61 std::chrono::system_clock::time_point m_LastUpdateRecordTime;
63 std::string m_LastUpdateLogText;
65 std::string m_sAlertDescript;
67 std::string m_sServerAbility;
69 std::string m_sExecuteAbility;
70
71 private:
72 // 禁止拷贝构造函数
73 CRDMSLogHelper(const CRDMSLogHelper&) = delete;
74 // 禁止拷贝赋值运算符
75 CRDMSLogHelper& operator=(const CRDMSLogHelper&) = delete;
76
78 void UpdateClientStatus();
80 void ExecuteUpload();
88 bool ExecuteNonQuery(const std::string& procName, const std::string& param);
94 bool WriteFinished();
95 public:
97 CRDMSLogHelper();
99 ~CRDMSLogHelper();
100
110 bool StartRDMSLogSave(const std::string& sProductName, const std::string& sVersion,
111 const std::string& sUserName = "MIMP", int iTickSecond = 10 * 60000);
113 bool IsStart();
115 void StopRDMSLogSave();
121 void PushAlterMessage(const std::string& sDescript);
127 void PushServerAbility(const std::string& sServerAbility);
133 void PushExecuteAbility(const std::string& sExecuteAbility);
134
136 void ClearStatusAlert();
143 void PushErrorLogInfo(const std::string& context, const std::string& sLogType = {});
150 void PushWaringLogInfo(const std::string& context, const std::string& sLogType = {});
157 };
158}
void ClearStatusAlert()
定义 RDMSLogHelper.cpp:227
bool StartRDMSLogSave(const std::string &sProductName, const std::string &sVersion, const std::string &sUserName="MIMP", int iTickSecond=10 *60000)
定义 RDMSLogHelper.cpp:165
void PushAlterMessage(const std::string &sDescript)
定义 RDMSLogHelper.cpp:209
void PushWaringLogInfo(const std::string &context, const std::string &sLogType={})
定义 RDMSLogHelper.cpp:251
void StopRDMSLogSave()
定义 RDMSLogHelper.cpp:192
bool RegisterCurrentClient()
定义 RDMSLogHelper.cpp:267
void PushExecuteAbility(const std::string &sExecuteAbility)
定义 RDMSLogHelper.cpp:221
bool IsStart()
定义 RDMSLogHelper.cpp:187
void PushServerAbility(const std::string &sServerAbility)
定义 RDMSLogHelper.cpp:215
void PushErrorLogInfo(const std::string &context, const std::string &sLogType={})
定义 RDMSLogHelper.cpp:235
定义 AutoUpdateHelper.h:8
定义 RDMSLogHelper.h:17
bool bError
定义 RDMSLogHelper.h:21
std::string context
定义 RDMSLogHelper.h:27
std::string type
定义 RDMSLogHelper.h:19
int color
定义 RDMSLogHelper.h:23
std::chrono::system_clock::time_point time
定义 RDMSLogHelper.h:25