You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Robert Middleton (Jira)" <lo...@logging.apache.org> on 2021/03/11 01:55:00 UTC
[jira] [Updated] (LOGCXX-515) Add macros to utilize libfmt
formatting for messages
[ https://issues.apache.org/jira/browse/LOGCXX-515?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Middleton updated LOGCXX-515:
------------------------------------
Fix Version/s: 0.12.0
> 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
> Priority: Major
> Fix For: 0.12.0
>
>
> 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)