Boost logo

Boost :

Subject: Re: [boost] [log] How to set/reset a channel-specific filter
From: Andreas Huber (ahd6974-spamboostorgtrap_at_[hidden])
Date: 2010-03-16 13:22:21


"Andrey Semashev" <andrey.semashev_at_[hidden]> wrote in message
news:4B9FAFD5.50409_at_gmail.com...
>> If we go with method a), we'd need a way to enumerate all global
>> loggers.
>
> Not sure why would you need to enumerate loggers. You could simply specify
> all the channels in the filter, if their number is not very big.

Loggers are declared by thrird party code, so we have no idea about the
number of loggers.

> If it is, you can create your own function that accepts the channel name
> and then decides if it is enabled. This function can then be converted
> into a filter like this:
>
> bool is_channel_enabled(std::string const& chan_name);
>
>
> sink->set_filter(
> flt::attr< std::string >("Channel").satisfies(&is_channel_enabled)
> );

Ok, that will certainly work for us, but I'd consider this a (small) hack,
because we'd have to duplicate information that is presumably already
present in Boost.Log.

More precisely, we want to provide a utility function where you pass in a
logger and a severity and the function then modifies the global filter so
that all records comming from the specified logger with a severity below the
specified one will be discarded. Unless I'm missing something, this would
require us keeping a global list of all loggers that have a filter applied,
correct?

I assumed that somewhere Boost.Log keeps such a list anyway, so I'd rather
use that one than build our own.

Thanks & Regards,

-- 
Andreas Huber
When replying by private email, please remove the words spam and trap
from the address shown in the header. 

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