prod_cc/include/audit_logger.hpp

78 lines
2.3 KiB
C++
Raw Permalink Normal View History

2026-07-13 03:03:59 +00:00
#ifndef IMS_AUDIT_LOGGER_HPP
#define IMS_AUDIT_LOGGER_HPP
#include "ims_types.hpp"
#include <memory>
#include <vector>
namespace ims {
/// @brief 审计日志管理类。
///
/// 负责系统登录日志、操作日志、异常日志的记录与溯源查询。
class AuditLogger {
public:
AuditLogger();
~AuditLogger();
// ==================== 登录日志记录 (SRS-IMS_F-023) ====================
/**
* @brief
*
* @requirement(name="登录日志记录", id="SRS-IMS_F-023")
* /IP
*/
void logLogin(int64_t user_id,
const std::string& username,
bool success,
const std::string& ip_address);
// ==================== 操作日志记录 (SRS-IMS_F-024) ====================
/**
* @brief
*
* @requirement(name="操作日志记录", id="SRS-IMS_F-024")
*
*/
void logOperation(int64_t user_id,
const std::string& username,
const std::string& action,
const std::string& detail);
// ==================== 异常日志记录 (SRS-IMS_F-025) ====================
/**
* @brief
*
* @requirement(name="异常日志记录", id="SRS-IMS_F-025")
*
*/
void logException(const std::string& action,
const std::string& detail);
// ==================== 日志溯源查询 (SRS-IMS_F-026) ====================
/**
* @brief
*
* @requirement(name="日志溯源查询", id="SRS-IMS_F-026")
*
*/
std::vector<LogEntry> queryLogs(
LogType log_type,
int64_t user_id,
const std::string& keyword,
const std::chrono::system_clock::time_point& start_time,
const std::chrono::system_clock::time_point& end_time);
private:
struct Impl;
std::unique_ptr<Impl> pImpl_;
};
} // namespace ims
#endif // IMS_AUDIT_LOGGER_HPP