C++客户端开发接口库 V5.1.8.15
连接信创集成中间件服务程序的二次开发接口
载入中...
搜索中...
未找到
mdwc::CMDWLogger类 参考

#include <MDWLogger.h>

Public 成员函数

 CMDWLogger (const std::string &sProductName, const std::string &sWorkDirectory="", int iLogFileRetentionDays=100)
 ~CMDWLogger ()
void SetWriteDebugLog (bool bWrite)
void SetDebugLogFuntion (const std::string &sFunConfig)
bool NeedWriteDebugLog (int iFunNo)
void CloseLogFile ()
void OpenLogFile ()
void ClearLogFile ()
void StartProcLog ()
void StopProcLog ()
void Push (LOGLEVEL Level, const std::string &sFunctionName, const std::list< std::string > &lstMsg)
void Push (LOGLEVEL Level, const std::string &sFunctionName, const std::string &sLogMsg)
void Push (LOGLEVEL Level, const std::string &sFunctionName, const char *fmt,...)
void PushError (const std::string &sFunctionName, const std::string &sLogMsg)
void PushError (const std::string &sFunctionName, const char *fmt,...)
void PushWaring (const std::string &sFunctionName, const std::string &sLogMsg)
void PushWaring (const std::string &sFunctionName, const char *fmt,...)
void Push (const std::string &sFunctionName, const std::exception &ex)
bool Pop (MDWLogMsg &logmsg)
bool WriteFinshed ()

详细描述

中间件通信库内部日志记录类,生成单独的日志文件,只用于内部运行逻辑分析

构造及析构函数说明

◆ CMDWLogger()

mdwc::CMDWLogger::CMDWLogger ( const std::string & sProductName,
const std::string & sWorkDirectory = "",
int iLogFileRetentionDays = 100 )

构造函数.

参数
sProductName产品名称,用于生成不同的日志文件
sWorkDirectory用于创建日志工作文件夹
iLogFileRetentionDays日志文件保留天数
函数调用图:

◆ ~CMDWLogger()

mdwc::CMDWLogger::~CMDWLogger ( )
函数调用图:

成员函数说明

◆ ClearLogFile()

void mdwc::CMDWLogger::ClearLogFile ( )

清除当前日志文件

◆ CloseLogFile()

void mdwc::CMDWLogger::CloseLogFile ( )

关闭所有的日志文件

这是这个函数的调用关系图:

◆ NeedWriteDebugLog()

bool mdwc::CMDWLogger::NeedWriteDebugLog ( int iFunNo)

当前功能是否需要写调试日志.

参数
iFunNo功能号
返回
true:需要,false:不需要

◆ OpenLogFile()

void mdwc::CMDWLogger::OpenLogFile ( )

用记事本打开当前日志文件

◆ Pop()

bool mdwc::CMDWLogger::Pop ( MDWLogMsg & logmsg)

从队列中取出最早的日志消息.

参数
logmsg用于存储取出的日志消息
返回
如果成功取出日志消息返回true,队列为空返回false

◆ Push() [1/4]

void mdwc::CMDWLogger::Push ( const std::string & sFunctionName,
const std::exception & ex )

添加异常信息到日志队列.

参数
sFunctionName执行函数名称
ex异常对象

◆ Push() [2/4]

void mdwc::CMDWLogger::Push ( LOGLEVEL Level,
const std::string & sFunctionName,
const char * fmt,
... )

添加单条日志消息到队列.

参数
Level日志级别
sFunctionName执行函数名称
fmt字符串格式化内容
函数调用图:

◆ Push() [3/4]

void mdwc::CMDWLogger::Push ( LOGLEVEL Level,
const std::string & sFunctionName,
const std::list< std::string > & lstMsg )

添加日志消息到队列.

参数
Level日志级别
sFunctionName执行函数名称
lstMsg日志消息列表
函数调用图:
这是这个函数的调用关系图:

◆ Push() [4/4]

void mdwc::CMDWLogger::Push ( LOGLEVEL Level,
const std::string & sFunctionName,
const std::string & sLogMsg )

添加单条日志消息到队列.

参数
Level日志级别
sFunctionName执行函数名称
sLogMsg日志内容

◆ PushError() [1/2]

void mdwc::CMDWLogger::PushError ( const std::string & sFunctionName,
const char * fmt,
... )

添加错误信息到日志队列.

参数
sFunctionName执行函数名称
fmt字符串格式化内容
函数调用图:

◆ PushError() [2/2]

void mdwc::CMDWLogger::PushError ( const std::string & sFunctionName,
const std::string & sLogMsg )

添加错误信息到日志队列.

参数
sFunctionName执行函数名称
sLogMsg日志内容
这是这个函数的调用关系图:

◆ PushWaring() [1/2]

void mdwc::CMDWLogger::PushWaring ( const std::string & sFunctionName,
const char * fmt,
... )

添加警告信息到日志队列

参数
sFunctionName执行函数名称
fmt字符串格式化内容
函数调用图:

◆ PushWaring() [2/2]

void mdwc::CMDWLogger::PushWaring ( const std::string & sFunctionName,
const std::string & sLogMsg )

添加警告信息到日志队列

参数
sFunctionName执行函数名称
sLogMsg日志内容
这是这个函数的调用关系图:

◆ SetDebugLogFuntion()

void mdwc::CMDWLogger::SetDebugLogFuntion ( const std::string & sFunConfig)

设置需要写数据日志的功能与列表.

参数
sFunConfig功能配置,格式:[功能编号1,功能编号2,...]
函数调用图:

◆ SetWriteDebugLog()

void mdwc::CMDWLogger::SetWriteDebugLog ( bool bWrite)
inline

设置保存调试日志

◆ StartProcLog()

void mdwc::CMDWLogger::StartProcLog ( )

启动日志保存线程

◆ StopProcLog()

void mdwc::CMDWLogger::StopProcLog ( )

停止日志保存线程

函数调用图:
这是这个函数的调用关系图:

◆ WriteFinshed()

bool mdwc::CMDWLogger::WriteFinshed ( )

检查所有日志是否已写入文件完成.

返回
如果队列为空(所有日志已处理)返回true,否则返回false
这是这个函数的调用关系图:

该类的文档由以下文件生成:
  • E:/GreatMIMP.Linux.Client/MDWClient/MDWLogger.h
  • E:/GreatMIMP.Linux.Client/MDWClient/MDWLogger.cpp