Boost logo

Boost Users :

Subject: Re: [Boost-users] [log] connecting a logger to a specific sink
From: Igor R (boost.lists_at_[hidden])
Date: 2013-12-04 06:47:22


> I think what you need to do is to add filters to your sinks so that they
> only take
> the log record that they are supposed to write.
> Basically, boost log is built as a hub:
>
> n log-record -> 1 core -> n sinks
>
> So if you prefer something like that:
>
> log-record A -> core -> sinks A
> log-record B -> core -> sinks B
> log-record C -> core -> sinks C
>
> Then it's not directly supported at the moment (Andrey correct me if I'm
> wrong).
> So you have to do 2 things:
> - add the information of which kind of log is a log-record
> - add filters to each sinks so that they take only log-records of a
> specific kind

Thanks, I see.
I'm currently trying to figure out how to configure such a filtering
without overcomplicating the whole task.
Currently, I'm passing different logger objects to different instances
of my class, and I wouldn't like those instances to perform any
additional log-related actions, besides BOOST_LOG(logger) << "some
message";
So if it were possible to associate some attribute value with each
logger, that would probably solve my problem: I could create as much
sinks as I need, while filtering every sink like this:
 sink->set_filter(expr::has_attr(my_attr) && my_attr == n);
Is it possible to "link" an attribute value to a logger?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net