Boost logo

Boost :

Subject: Re: [boost] Review - boost::log
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2010-03-14 15:10:01


On 03/14/2010 09:50 PM, Tom Brinkman wrote:
> You coud probably fix all my concerns by adding something like the
> following.
>
> Notice that there are no macros, no templates, its header file only and it
> does not require any other boost libraries.
>
> Usage: boost::error("An Error has occured: %s\n", "Put message here");

I'd say that interface is very limited and unsafe. But if you like it,
you can write a wrapper header around Boost.Log in the following style:

void error (const char *format, ...)
{
   va_list args;
   va_start (args, format);

   char buf[1024];
   vsnprintf(buf, sizeof(buf), format, args);

   va_end (args);

   BOOST_LOG_TRIVIAL(error) << buf;
}


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk