
"Darren Cook" <darren@dcook.org> wrote in message news:4272B304.3000100@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