From: Boris (boriss_at_[hidden])
Date: 2008-08-20 13:58:25


On Wed, 20 Aug 2008 19:46:17 +0200, Andrey Semashev
<andrey.semashev_at_[hidden]> wrote:

> 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.

I see. Then I misunderstood how the filters work. But then again I don't
understand why the first message is not written as the severity level is
warn (1) and it is greater than info (0)? It should pass the filter?

Boris