eis/eqpalg/gb_logger.h
Huamonarch 224c2c45c4 Remove irrelevant comments from eqpalg source files
Cleaned 66 files across all eqpalg subdirectories:
- Removed commented-out dead code
- Removed redundant Chinese inline comments that restate variable/function names
- Removed trailing ///< annotations on self-explanatory fields
- Removed namespace closing comments
- Preserved all file headers, Doxygen documentation, and logic explanations
- No code changes — only comment removal
2026-05-09 13:30:09 +08:00

72 lines
1.5 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
/**
* @file eqpalg/gb_logger.h
* @brief eqpalg下的全局logger
* @author Cat (null.null.null@qq.com)
* @version 0.1
* @date 2021-07-08
* 全局logger把log信息打印到指定的日志中
* Company: Baosight Co. Ltd.
* DO NOT COPY/USE WITHOUT PERMISSION
*
*/
#include <log4cplus/LOG.h>
#include <boost/assert/source_location.hpp>
#include <exception>
#include <filesystem>
#include <fstream>
#include <memory>
#include <string>
/**
* @brief 全局Logger负载打印Log
*/
class GbLogger {
private:
std::unique_ptr<LOG> gb_logger_;
std::unique_ptr<LOG> local_logger_;
std::string rule_id_;
std::string rule_name_;
public:
/**
* @brief Construct a new Global Logger object
* @param prefix 自定义的logger前缀
*/
GbLogger(std::string prefix);
/**
* @brief Construct a new Global Logger object
* @param ruleId 算法id
* @param rule_name 算法名
* 前缀是两者的加和
*/
GbLogger(std::string ruleId, std::string rule_name);
~GbLogger();
/**
* @brief 打印异常的方法输出到ERROR
* @param e 捕获的异常
* @return int
*/
int log_exception(const std::exception& e);
/**
* @brief 输出信息到ERROR
* @return int
*/
int log_error(std::string&&);
int log_error(const std::string&);
/**
* @brief 打印信息到本地的INFO
* @return int
*/
int log_info_local_thread(std::string&&);
/**
* @brief 打印信息到全局的INFO
* @return int
*/
int log_info(std::string&&);
};