
Caleb Epstein wrote:
On 4/29/05, Gennadiy Rozental <gennadiy.rozental@thomson.com> wrote:
"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.
Gennadiy: to do what you suggest would seem to me to require (a) no buffering and (b) an interface which is likely not thread-safe. Or am I missing something.
Gennadiy, correct me if I'm wrong but as you wrote your post as a reply to mine, I can see a connection: You seem to prefer the unbuffered logging to have at least the partial information before an exception occurs and to avoid complexity in the implementation of the logging library by avoiding the buffering code, right? FWIW, I think buffering should still be used, with an occasional <<std::flush here and there. The main problem is, that it's not sufficient to have a normal buffered stream (which usually has a fixed-sized buffer), but to handle an unlimited buffer. This involves memory managment, although I have to admit that the code I showed "solves" this by moving the problem to the user's expression. But then, maybe, I completely missed your point :) Regards, Daniel