Boost logo

Boost :

From: John Torjo (john.lists_at_[hidden])
Date: 2004-11-05 12:32:52


> Just a quick thought that came to my mind...
>
> Did you consider using the syntax 'BOOST_LOG(dbg, "message" << foobar);'
> instead of 'BOOST_LOG(dbg) << "message" << foobar;'?
>
> While I think the syntax you use looks far nicer, we ususally need the
> ability to be able to compile away the logging calls completely and this
> only can be done with the first form.
>

In practice, you seldom need to turn them off completely.
A possibility to enable/disable them at runtime will be usually desired.
This is what BOOST_LOG does (see the rest of the thread).

It is equivalent to:

if ( is_enabled(log)) log << whatever << you_wish;

As a side-note, you can always redefine
// similar to
#define BOOST_LOG(x) if (false) x

which will remove all log calls (probaly in release mode).

Best,
John

-- 
John Torjo,    Contributing editor, C/C++ Users Journal
-- "Win32 GUI Generics" -- generics & GUI do mix, after all
-- http://www.torjo.com/win32gui/
-- v1.5 - tooltips at your fingertips (work for menus too!)
    + bitmap buttons (work for MessageBox too!)
    + tab dialogs, hyper links, lite html

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