eis/eqpalg/gb_logger.h

72 lines
1.6 KiB
C
Raw Normal View History

#pragma once
/**
* @file eqpalg/gb_logger.h
* @brief eqpalg下的全局logger
* @author Cat (null.null.null@qq.com)
* @version 0.1
* @date 2021-07-08
* loggerlog信息打印到指定的日志中
* 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 LoggerLog
*/
class GbLogger {
private:
std::unique_ptr<LOG> gb_logger_; // 全局logger
std::unique_ptr<LOG> local_logger_; // 本地logger
std::string rule_id_; ///<规则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&&);
};