logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christophe de VIENNE <cdevie...@alphacent.com>
Subject Re: Question on logger hierarchy
Date Thu, 09 Sep 2004 07:54:17 GMT
Curt Arnold a écrit :

> On Sep 8, 2004, at 7:38 AM, Robert Haschke wrote:
>
>> In future releases, it would be very convenient to have logger methods,
>> which allow printf-like formatting.
>
> I'd like to keep the LOG4CXX_level macros as simple as possible (and 
> simpler than they are now).  I don't think printf is desirable since 
> so many had things can happen if the format specifiers don't match the 
> arguments.

I personnaly use boost::format to achieve this goal, combined with a 
function _() which is use gettext :

inline boost::format _(const char * s) {
    return boost::format( gettext(s) );
}

Then I can write stuffs like :

LOG4CXX_ERROR(logger, _("Error while opening file '%1%': '%2%'") % 
filename % reason );

I think this is much more preferable than adding printf like functions 
on loggers.

Regards,

Christophe

-- 
Christophe de Vienne



Mime
View raw message