Details
-
New Feature
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Create macros that use fmt::format to create the log message.
The prototype looks like this:
#define LOG4CXX_INFO_FMT(logger, ...) do { \ if (logger->isInfoEnabled()) {\ logger->forcedLog(::log4cxx::Level::getInfo(), fmt::format( __VA_ARGS__ ), LOG4CXX_LOCATION); }} while (0)
Usage:
LOG4CXX_INFO_FMT( logger, "This is a message that has some kind of {} information in it", "useful" );
This is slightly faster at runtime than using the MessageBuffer class with operator<< all the time, and much clearer. Conveniently, the coloring provided by libfmt also shows up on the output.
is there a better name than LOG4CXX_INFO_FMT?