Boost logo

Boost :

Subject: Re: [boost] [log] Release candidate 1
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2013-03-10 23:17:55

On Monday 11 March 2013 02:24:44 Darren Garvey wrote:
> Hi Andrey,
> I'm glad you've added the trivial logger. As big as that warning is in the
> documentation, it would be more reassuring to see that this logger supports
> lazy evaluation of the logging expression if the example demonstrated it.
> eg.
> // Note: some_very_expensive_operation() won't be called unless debug
> logging is enabled.
> BOOST_LOG_TRIVIAL(debug) << "A debug severity message" <<
> some_very_expensive_operation();

Regardless of the logger you use, that's the case; the streaming expression
won't be evaluated if the filter does not pass the record. It's mentioned in
the docs in several places.

> I don't see a way to compile out certain levels of log messages using
> compile-time flags with the syntax Boost.Log uses. Many other logging
> libraries choose to put the logging expression as part of the macro, which
> makes it easy to support this usage pattern. Have you considered supporting
> this?

Yes, the idea floated around since the early days of the library. However, it
doesn't seem feasible without restricting to particular severity levels, so I
didn't implement that. You can always define your severity levels and your
logging macros that will use them and selectively expand these macros to
nothing depending on the configuration.

Boost list run by bdawes at, gregod at, cpdaniel at, john at