Boost logo

Boost :

Subject: Re: [boost] [log] Comments
From: Vladimir Prus (ghost_at_[hidden])
Date: 2010-03-16 01:50:01


On Tuesday 16 March 2010 01:34:52 Andrey Semashev wrote:

> On 03/15/2010 11:47 PM, Steven Watanabe wrote:
> > AMDG
> >
> > Vladimir Prus wrote:
> >> There's another thing about component/severity logging that I have
> >> apparently
> >> forgot about -- filtering. It is surely necessary to change filtered
> >> components
> >> dynamically -- either while the application is running, or between
> >> runs, therefore
> >> lambda expression that compares to a fixed string will not be enough
> >> -- we need
> >> a lookup in a map. It's not obvious to me how to form a lambda expression
> >> to do a lookup in a map using the library, e.g. something like:
> >>
> >> enabled_components.count(attr<string>("Component"))
> >>
> >> So I wonder:
> >>
> >> 1. What is the actual syntax to do this inside lambda expression.
> >
> > There is no simple syntax for it. (The lambda functionality is
> > rather crippled compared to a real lambda library.) You
> > could probably do it with boost::bind and the satisfies function.
> > Also, this by itself would be dangerous, since filters need to
> > be thread safe.
>
> In my view, the filter should be replaced on update. You can have the
> map of components or whatever, and the filter pointing to them. On
> update you create a new map and a new filter, and set it to the
> core/sinks. No additional locking required, no special syntax,
> everything's safe and clean. Same goes for formatters.

What about performance? If I have 100 components, copying map on
each update seems not too good. Locking is probably better.

- Volodya


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