📄 loginterface.h
字号:
//这个文件是使用Log功能的模块唯一应该包含的文件//对外的接口#ifndef __PF_LOGGER_HEADER_FILE__#define __PF_LOGGER_HEADER_FILE__#include "LogMacro.h"#include "OSErrorCode.h"
#include <string>
FILE* CreateDebugFile(const std::string strName);
#ifdef __cplusplus //如果是C++extern void _RunLog(const int nLevel, const int dwModuleID, const char* Desc, const char* File, const int Line);extern void _ErrLog(const int dwModuleID, const int dwErrCode, const char* strDesc, const int dwErrLevel, const char* File, const int Line);//运行日志#if 0 //是否关闭定义 #define RUN_LOGGER(nLevel, dwModuleID, Desc) ((void)0)#else #define RUN_LOGGER(nLevel, dwModuleID, Desc) { \ _RunLog(nLevel, dwModuleID, Desc, __FILE__, __LINE__); } #define RUN_LOGGER2(Desc) RUN_LOGGER(0, 0, Desc)#endif//错误日志#if 0 //是否关闭定义 #define ERR_LOGGER(nLevel, dwModuleID, ErrCode, Desc) ((void)0)#else #define ERR_LOGGER(nLevel, dwModuleID, ErrCode, Desc) { \ _ErrLog(dwModuleID, ErrCode, Desc, LOG_ERR_LEVEL_RUNNING, __FILE__, __LINE__); } #define ERR_LOGGER2(Desc) ERR_LOGGER(0, 0, 0, Desc)#endif#else //else __cplusplusextern void _RunLog_For_C(const int nLevel, const int dwModuleID, const char* Desc, const char* File, const int Line);extern void _ErrLog_For_C(const int dwModuleID, const int dwErrCode, const char* strDesc, const int dwErrLevel, const char* File, const int Line);//运行日志#if 0 //是否关闭定义 #define RUN_LOGGER(nLevel, dwModuleID, Desc) ((void)0)#else #define RUN_LOGGER(nLevel, dwModuleID, Desc) { \ _RunLog_For_C(nLevel, dwModuleID, Desc, __FILE__, __LINE__); }#endif//错误日志#if 0 //是否关闭定义 #define ERR_LOGGER(nLevel, dwModuleID, ErrCode, Desc) ((void)0)#else #define ERR_LOGGER(nLevel, dwModuleID, ErrCode, Desc) { \ _ErrLog_For_C(dwModuleID, ErrCode, Desc, LOG_ERR_LEVEL_RUNNING, __FILE__, __LINE__); }#endif#endif //end __cplusplus//简化参数#define ERR_PARAM_RETURN(Condition, retCode) \{ \ Assert(Condition); \ if(!(Condition)) \ return retCode; \}
#define ERR_PARAM_RETURN_NOVALUE(Condition) \
{ \
Assert(Condition); \
if(!(Condition)) \
return ; \
}
#define ERR_RETURN(errCode,errInfo,retCode) \{ \ Assert(FALSE);\ ERR_LOGGER(0,0,errCode,errInfo); \ return retCode; \}#define ERR_RETURN_NOVALUE(errCode,errInfo) \{ \ Assert(FALSE);\ ERR_LOGGER(0,0,errCode,errInfo); \ return ; \}#endif //end __PF_LOGGER_HEADER_FILE__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -