From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2004-10-29 02:22:17
Maxim Yegorushkin wrote:
> On Thu, 28 Oct 2004 19:29:18 +0200, John Torjo <john.lists_at_[hidden]>
>> 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.
> 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.
Now replace "something GUIsh" with anExpensiveFunction(). John's code
will not evaluate it when the logger is disabled. OTOH your code will
always evaluate it, which is IMHO not acceptable for a logging library.
-- Daniel Frey aixigo AG - financial solutions & technology Schloß-Rahe-Straße 15, 52072 Aachen, Germany fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99 eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk