|
Boost : |
Subject: Re: [boost] [log] Comments
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-03-15 16:47:29
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.
> 2. Can we implement a more convenient out-of-box mechanism.
> For example:
>
> logging::core()->enabled_components().add("c1")
>
> where this automatically affects the "Component" attribute.
>
In Christ,
Steven Watanabe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk