Robert Middleton created LOGCXX-515:
---------------------------------------

             Summary: Add macros to utilize libfmt formatting for messages
                 Key: LOGCXX-515
                 URL: https://issues.apache.org/jira/browse/LOGCXX-515
             Project: Log4cxx
          Issue Type: New Feature
            Reporter: Robert Middleton
            Assignee: Robert Middleton


Create macros that use fmt::format to create the log message.

 

The prototype looks like this:
{code:java}
#define LOG4CXX_INFO_FMT(logger, ...) do { \
                if (logger->isInfoEnabled()) {\
                        logger->forcedLog(::log4cxx::Level::getInfo(), 
fmt::format( __VA_ARGS__ ), LOG4CXX_LOCATION); }} while (0)
{code}
Usage:
{code:java}
LOG4CXX_INFO_FMT( logger, "This is a message that has some kind of {} 
information in it", "useful" );
{code}
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?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to