20 lines
609 B
C++
20 lines
609 B
C++
|
|
#include "mix_cc/debug/print.h"
|
||
|
|
namespace mix_cc {
|
||
|
|
namespace debug {
|
||
|
|
|
||
|
|
extern bool glob_debug_flag;
|
||
|
|
|
||
|
|
void print(std::string&& str, boost::source_location&& src_loc) {
|
||
|
|
if (glob_debug_flag) {
|
||
|
|
std::cout << nlohmann::json{{"info", str},
|
||
|
|
{"source_location",
|
||
|
|
std::string(src_loc.file_name()) +
|
||
|
|
std::to_string(src_loc.line())},
|
||
|
|
{"func_name", src_loc.function_name()}}
|
||
|
|
.dump(4)
|
||
|
|
<< std::endl;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
} // namespace debug
|
||
|
|
} // namespace mix_cc
|