| | |
| | | } |
| | | |
| | | // 初始化日志表 |
| | | bool SystemLogManager::initializeLogTable() { |
| | | bool SystemLogManager::initSystemLogTable() { |
| | | // 获取可执行文件路径 |
| | | char szPath[MAX_PATH]; |
| | | GetModuleFileName(NULL, szPath, MAX_PATH); |
| | |
| | | } |
| | | |
| | | // 构造数据库路径 |
| | | std::string dbPath = dbDir + "\\SystemLog.db"; |
| | | std::string dbPath = dbDir + "\\SystemLogManager.db"; |
| | | |
| | | // 连接数据库 |
| | | if (!m_pDB->connect(dbPath, true)) { |
| | |
| | | return m_pDB->executeQuery(createTableQuery); |
| | | } |
| | | |
| | | // 终止数据库连接 |
| | | void SystemLogManager::termSystemLogTable() { |
| | | if (!m_pDB) { |
| | | return; |
| | | } |
| | | |
| | | m_pDB->disconnect(); |
| | | } |
| | | |
| | | // 添加日志(使用当前用户) |
| | | bool SystemLogManager::log(LogType logType, const std::string& event) { |
| | | if (!m_pDB) { |