#include "mix_cc/exception/get_nested_exception.h" #include #include #include #include #include GbLogger::GbLogger(std::string prefix) { gb_logger_ = std::make_unique(prefix); local_logger_ = std::make_unique("local logger", AUTO_CATCH_PID); } GbLogger::GbLogger(std::string ruleId, std::string rule_name) { this->rule_id_ = ruleId; this->rule_name_ = rule_name; gb_logger_ = std::make_unique(rule_name_ + ":" + rule_id_); local_logger_ = std::make_unique(rule_name_ + ":" + rule_id_, AUTO_CATCH_PID); } GbLogger::~GbLogger() {} int GbLogger::log_exception(const std::exception& e) { gb_logger_->Error() << mix_cc::get_nested_exception(e) << std::endl; return 0; } int GbLogger::log_error(std::string&& str) { gb_logger_->Error() << str << std::endl; return 0; } int GbLogger::log_error(const std::string& str) { gb_logger_->Error() << str << std::endl; return 0; } int GbLogger::log_info_local_thread(std::string&& str) { local_logger_->Debug() << str << std::endl; return 0; } int GbLogger::log_info(std::string&& str) { gb_logger_->Debug() << str << std::endl; return 0; }