Boost logo

Boost :

From: Darren Cook (darren_at_[hidden])
Date: 2005-04-29 17:19:48

> Another thing (from the same domain) that I found especially difficult to
> deal with in my logging implementation is "intermixed logging":
> BOOST_LOG(..) << "Print result of f(): " << f();
> ...
> void f() {
> BOOST_LOG(..) << "Enter f()";
> ...
> BOOST_LOG(..) << "Exit f()";
> }
> Now to make it properly formatter isn't trivial at all.

(For the example to make sense f() shouldn't be void; I've assumed it is

Can a logging library really help here? Don't you have to write:
  int f_ret=f();BOOST_LOG(..) << "Print result of f(): "<<f_ret;

For when you want logging to compile out completely then a LOG_PREPARE()
macro may be useful:
   BOOST_LOG_PREPARE(int f_ret=f());
   BOOST_LOG(.., "Print result of f(): "<<f_ret);


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