Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2005-12-15 16:46:37


>> The current definition is (I believe)
>>
>> #define BOOST_LOG(logger) \
>> if(!logger.isEnabled()) {} else logger
>>
>> Which achieves the same ends. In particular, foo() is not called unless
>> logging occurs.
>
>
> But there is some additional overhead with the implementation in the
> proposed (and withdrawn) Logging library. The conditional actually
> creates
> a temporary object (enabled_logger) that contains a pointer to a
> heap-allocated stringstream (in the case of the log being enabled)

This is implementation detail of submitted library (mistake IMO) and should
not affect overall preferance on interface.
It is possible to implement filtering part efficiently without need for
extra memory allocation and unnecessary work
In my production projects in performance critical application I also use one
global variable that guard all DEBUG trace statements.

Gennadiy


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