Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2005-04-29 18:09:07


"Darren Cook" <darren_at_[hidden]> wrote in message
news:4272B304.3000100_at_dcook.org...
>> 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
> int).

Yep. My fault.

> 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;

No. It's not really convinient isn't it?

I understand that f log statements will interfere with original log
statement. The trick is to make sure that all prefixes are printed
correctly:

a.cpp:14: Print result of f():
b.cpp:75: Enter f()
b.cpp:95: Exit f()
a.cpp:14: 1234

Gennadiy


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