Boost logo

Boost :

From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2008-08-20 13:46:17


Boris wrote:
> Andrey,
>
> can you tell me why the following program writes the second message?
>
> ----------

[snip]

> boost::log::sources::severity_logger logger;
>
> int main()
> {

[snip]

> boost::log::logging_core::get()->set_filter(boost::log::filters::attr<int>("Severity")
> < warn);
>
> BOOST_LOG(logger) << "second message"; // Why is this message written??
> }
> ----------
>
> The first message is not written as the severity level warn is greater
> than info. However for the second message the default severity level
> info is smaller than warn. Thus I would expect the second message is not
> written either? Is this a bug?

The default severity will be 0, since the logger is default-constructed.
And since you set the filter to pass everything with level below warn
(which is 1), the second message passes the filter.


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