Subject: Re: [boost] [log] Comments
From: Vladimir Prus (ghost_at_[hidden])
Date: 2010-03-15 16:31:36
On Monday 15 March 2010 22:50:59 Steven Watanabe wrote:
> > // myproject.hpp
> > #ifndef COMPONENT
> > #define COMPONENT "unspecified"
> > #endif
> > #define DEBUG BOOST_LOG_XXX(mygloballogger, COMPONENT, debug)
> I guess that what I'd like is a way to specify arbitrary attributes when
> logging, so BOOST_LOG_XXX would be defined like
> #define BOOST_LOG_XXX(lg, component, severity) BOOST_LOG_WITH_ATTRS(lg,
> ("Severity", severity)("Channel", component))
Yes, I think this would be nice.
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:
So I wonder:
1. What is the actual syntax to do this inside lambda expression.
2. Can we implement a more convenient out-of-box mechanism.
where this automatically affects the "Component" attribute.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk