46 lines
1.2 KiB
C++
46 lines
1.2 KiB
C++
|
|
#include "mix_cc/exception/get_nested_exception.h"
|
||
|
|
#include <eqpalg/gb_logger.h>
|
||
|
|
#include <memory>
|
||
|
|
#include <sstream>
|
||
|
|
#include <string>
|
||
|
|
#include <thread>
|
||
|
|
|
||
|
|
GbLogger::GbLogger(std::string prefix) {
|
||
|
|
gb_logger_ = std::make_unique<LOG>(prefix);
|
||
|
|
local_logger_ = std::make_unique<LOG>("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<LOG>(rule_name_ + ":" + rule_id_);
|
||
|
|
local_logger_ =
|
||
|
|
std::make_unique<LOG>(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;
|
||
|
|
}
|