12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- const std::regex _reg_file(R"(.*/([\S]*[\.][\S]*)$)");
- do{ \
- auto _now = std::chrono::system_clock::now(); \
- std::time_t _now_c = std::chrono::system_clock::to_time_t(_now); \
- std::string _log_time = fmt::format("{:%Y-%m-%d %H:%M:%S}", fmt::localtime(_now_c)); \
- std::string _log_file_src = __FILE__; \
- auto _log_file = std::regex_replace(_log_file_src, _reg_file, "$1"); \
- std::string _log_str = fmt::format(__VA_ARGS__); \
- fmt::print(fg(fmt::color::blue), "[{}][{}:{}] {}\n",_log_time,_log_file ,__LINE__ ,_log_str); \
- }while(0)
- do{ \
- auto _now = std::chrono::system_clock::now(); \
- std::time_t _now_c = std::chrono::system_clock::to_time_t(_now); \
- std::string _log_time = fmt::format("{:%Y-%m-%d %H:%M:%S}", fmt::localtime(_now_c)); \
- std::string _log_file_src = __FILE__; \
- auto _log_file = std::regex_replace(_log_file_src, _reg_file, "$1"); \
- std::string _log_str = fmt::format(__VA_ARGS__); \
- fmt::print(fg(fmt::color::green), "[{}][{}:{}] {}\n",_log_time,_log_file ,__LINE__ ,_log_str); \
- }while(0)
- do{ \
- auto _now = std::chrono::system_clock::now(); \
- std::time_t _now_c = std::chrono::system_clock::to_time_t(_now); \
- std::string _log_time = fmt::format("{:%Y-%m-%d %H:%M:%S}", fmt::localtime(_now_c)); \
- std::string _log_file_src = __FILE__; \
- auto _log_file = std::regex_replace(_log_file_src, _reg_file, "$1"); \
- std::string _log_str = fmt::format(__VA_ARGS__); \
- fmt::print(fg(fmt::color::yellow), "[{}][{}:{}] {}\n",_log_time,_log_file ,__LINE__ ,_log_str); \
- }while(0)
- do{ \
- auto _now = std::chrono::system_clock::now(); \
- std::time_t _now_c = std::chrono::system_clock::to_time_t(_now); \
- std::string _log_time = fmt::format("{:%Y-%m-%d %H:%M:%S}", fmt::localtime(_now_c)); \
- std::string _log_file_src = __FILE__; \
- auto _log_file = std::regex_replace(_log_file_src, _reg_file, "$1"); \
- std::string _log_str = fmt::format(__VA_ARGS__); \
- fmt::print(fg(fmt::color::red), "[{}][{}:{}] {}\n",_log_time,_log_file ,__LINE__ ,_log_str); \
- }while(0)
|