#pragma once #include #include enum enLogType { ELT_Log_ALL = 0, // Debug.ini[system]Debug=1生效 ELT_Log_Debug, // 错误日志,不自动删除和清空 ELT_Log_Error, // 文件日志,就一个文件,超过10M自动清空,如记录xml,json的信息 ELT_Log_File, // 一定会输出的日志 // 操作日志,如点击按钮,按快捷键 ELT_Log_Operator, // 仅仅主程序记录,按键日志 ELT_Log_KeyDown, // 通用日志,无特殊标记 ELT_Log_Common, }; class CLHQLogApi { public: CLHQLogApi(); ~CLHQLogApi(); private: typedef int (*FunDoInitial)(const char* szLogName); typedef int (*FunDoWriteLog)(const char* szLogName, int nLogType, const char* szLog); typedef int (*FunDoWriteFileLog)(const char* szFilePath, const char* szLog); //获取是否开启了Debug模式: 0未开启, 1已开启 typedef int (*FunGetDebug)(); private: QLibrary m_QLib; FunDoInitial fnDoInitial; FunDoWriteLog fnDoWriteLog; FunDoWriteFileLog fnDoWriteFileLog; FunGetDebug fnGetDebug; public: int Load(QString file); public: int DoInitial(QString strLogName); // 为了适应,一个进程多模块日志的功能,需要给出Log名称 int DoWriteLogEx(QString strLogName, int nLogType, QString strLog); int DoWriteFileLog(QString strLogFilePath, QString strLog); public: QString m_strLogName; int DoWriteLog(int nLogType, QString strLog); bool IsInDebugMode(); };