Boost logo

Boost :

From: martin.ecker_at_[hidden]
Date: 2005-08-05 05:48:01


Hello John,

John Torjo wrote:
> So, I could implement something like this:
> If a message's level is higher than level X, output it to some
destinations.
>
> At this time, you specify the destinations per log-hierarchy.

I must admit I haven't followed the discussion on log levels closely,
but if you add this feature then wouldn't there be any difference
between the log hierarchy and log levels?

We've been using version 1.3 of the library, which doesn't yet provide
log levels, so we simply define log levels by having special logs in
the hierarchy.

For example, let's say one of our libraries is called Input, then we'd
have the following logs declared for it:

namespace Input
{

BOOST_DECLARE_LOG_DEBUG(Debug)
BOOST_DECLARE_LOG(Info)
BOOST_DECLARE_LOG(Warning)
BOOST_DECLARE_LOG(Error)

} // namespace Input

and defined like this:

namespace Input
{

BOOST_DEFINE_LOG(Debug, "Input.Debug")
BOOST_DEFINE_LOG(Info, "Input.Info")
BOOST_DEFINE_LOG(Warning, "Input.Warning")
BOOST_DEFINE_LOG(Error, "Input.Error")

} // namespace Input

Then we set up appenders for each log. For example, the debug log only
goes to a debut output stream. The info log goes to a file, the
warning log goes to a file, the error log goes to a local file and to
a socket stream over the network.

What additional benefit do we get with the current implementation of
log levels? Furthermore, if log levels can have string names and can
have different appenders, I don't see the difference to what we're
currently doing...

Best Regards,
Martin

TAB Austria
Haiderstraße 40
4052 Ansfelden
Austria
Phone: +43 7229 78040-218
Fax: +43 7229 78040-209
E-mail: martin.ecker_at_[hidden]
http://www.tab.at


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