5inline std::string LogLocationToStr(
int line,
const char* file,
7 return std::string(
"Logged from function '") + func +
"' in file '" + file +
8 "' at line " + std::to_string(line) +
".\n";
12class XpansionError :
public T {
14 explicit XpansionError(
const std::string& err_message,
15 const std::string& log_location)
16 : T(log_location + err_message), err_message_(err_message) {}
17 explicit XpansionError(
const std::string& prefix,
18 const std::string& err_message,
19 const std::string& log_location)
20 : T(log_location + prefix + err_message), err_message_(err_message) {}
23 std::string ErrorMessage()
const {
return err_message_; }
26 const std::string err_message_;
29enum class LOGLEVEL { NONE, TRACE, DEBUG, INFO, WARNING, ERR, FATAL };
30enum class LOGGERTYPE { NONE, FILE, CONSOLE };
31inline std::string LogLevelToStr(
const LogUtils::LOGLEVEL log_level) {
33 case LogUtils::LOGLEVEL::TRACE:
35 case LogUtils::LOGLEVEL::DEBUG:
37 case LogUtils::LOGLEVEL::INFO:
39 case LogUtils::LOGLEVEL::WARNING:
41 case LogUtils::LOGLEVEL::ERR:
43 case LogUtils::LOGLEVEL::FATAL:
51#define LOGLOCATION LogUtils::LogLocationToStr(__LINE__, __FILE__, __func__)