|
Boost : |
From: John Torjo (john.lists_at_[hidden])
Date: 2005-05-21 23:09:19
>
> The scenario we use is something akin to the following (using macros):
>
>
> LOG(int level, string tag) << "whatever";
>
> The logging (as a whole) can be enabled/disabled. When enabled,
> portions (according to the 'tag') as well as the level, can be
> selectively enabled.
Besides levels, the rest is already in the existing lib.
>
> Levels and tags are automatically inserted into the stream (for
> post-filtering if desired).
>
> We generally have different logs/streams for different types of
> logging: errors, warnings, developer messages, determinism checks:
>
> ERROR_LOG(...) << ...;
> WARNING_LOG(...) << ...;
> etc.
>
Yup... Similar usage: BOOST_LOG(err), BOOST_LOG(warn), etc.
Of course, you can create your own macros, if you wish:
#define ERROR_LOG BOOST_LOG(err)
> Which of course can be tied (at runtime) to the same stream or
> different streams.
Yup...
>
> There's always the push for "speed", so a compile-time disabling
> (akin to NDEBUG for asserts) of certain streams is required.
>
Already done, as suggested by Darren Cook.
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.6.3 (Resource Splitter) -- http://www.torjo.com/cb/ - Click, Build, Run!
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk