add LOG_FORMAT.
This commit is contained in:
parent
572396625c
commit
680f916073
@ -4,4 +4,5 @@
|
|||||||
BOOST_AUTO_TEST_CASE(BoostLogTest) {
|
BOOST_AUTO_TEST_CASE(BoostLogTest) {
|
||||||
boost::log::initialize();
|
boost::log::initialize();
|
||||||
LOG(info) << "this is a test output.";
|
LOG(info) << "this is a test output.";
|
||||||
|
LOG_FORMAT(info, "i am %s, %d years old.", "amass", 29);
|
||||||
}
|
}
|
@ -216,6 +216,12 @@ BOOST_LOG_GLOBAL_LOGGER(location_logger, LocationLogger<boost::log::trivial::sev
|
|||||||
(AmassKeywords::LineTag = __LINE__) \
|
(AmassKeywords::LineTag = __LINE__) \
|
||||||
(AmassKeywords::CategoryTag = #cat))
|
(AmassKeywords::CategoryTag = #cat))
|
||||||
|
|
||||||
|
#define LOG_FORMAT(lvl,...)\
|
||||||
|
auto xxx_size = snprintf(nullptr,0,__VA_ARGS__);\
|
||||||
|
std::string xxx_buffer(xxx_size,'\0');\
|
||||||
|
snprintf(xxx_buffer.data(),xxx_buffer.size(),__VA_ARGS__);\
|
||||||
|
LOG(lvl)<<std::move(xxx_buffer);
|
||||||
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
#include "BoostLog.inl"
|
#include "BoostLog.inl"
|
||||||
|
Loading…
Reference in New Issue
Block a user