Boost logo

Boost :

From: Darren Cook (darren_at_[hidden])
Date: 2005-04-25 21:02:54


>> Hi. If I understand right the code, even if log is disabled, I do pay
>> for constructing
>> log messages. Am I right? If so why do you force this?
>
> No, you donot pay.
>
> BOOST_LOG(app) << "testing " << i << '-' << j << '-' << k;
>
> Is the equivalent of:
>
> if ( is_log_enabled(app) ) app_log() << "testing" << i ...;

But it is still taking up space; not to mention CPU usage doing a
run-time check to see if a log is enabled.

I think it is very important that we can choose to build with all
logging code removed. This has been discussed before, and I thought you
were going to include an alternative macro, something like:
  BOOST_LOG(app,"testing " << i << '-' << j << '-' << k);

(Would that compile? If so I think this should be the main macro, and
the above format the alternative.)

Darren


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