
On Thu, 28 Oct 2004 19:29:18 +0200, John Torjo <john.lists@torjo.com> wrote:
As for scoped logs, to make a long story short, you'll be able to do: logger gui("app.gui") if (gui) gui.stream() << "something GUIsh"; // or (equivalent) BOOOST_SCOPEDLOG(gui) << "something GUIsh";
There is an option for avoiding if() checks in client code at all. All you have to do is to implement operator<< for logger class. class logger { // ... template<class T> logger const& operator<<(T const& t) const { if(/*the check is here*/) this->stream_ << t; return *this; } // ... }; And then in client code: logger("app.gui") << "something GUIsh"; Though I am not sure, if a compiler will be able to optimize checks for every operator<<() to a single check for the entire output expression. -- Maxim Yegorushkin