Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2004-11-12 12:21:10

Markus Schöpflin wrote:
> John Torjo wrote:
>> Finally, have had some time to update the logging lib. Get it from:
>> (of course, it comes packed with docs)
> 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.

Why not do:
    #define BOOST_LOG(id) /##/
to remove the logs at compile time?

The only issue AFAICS is that the above needs the BOOST_LOG usage on a
single line. But if you need multi-line support, can't you have
BOOST_LOG_BEGIN(id)/END like this:

    #define BOOST_LOG_BEGIN(id) /##*
    #define BOOST_LOG_END *##/


    BOOST_LOG(dbg) << "message" << foobar;
       << "message" << foobar;

Effectively transforming this into:

    // << "message" << foobar;
       << "message" << foobar;

You would need to be careful about usage of C-style comments within
these macros:

    BOOST_LOG(dbg) << foobar; /*
       line above commented out: error at '*/'
       << foobar; /**< error here: nested C-style comment */


Boost list run by bdawes at, gregod at, cpdaniel at, john at