Boost logo

Boost :

Subject: Re: [boost] [Boost.Log] SimpleEventLog configuration
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2013-08-26 23:38:59


On Monday 26 August 2013 22:58:56 Pieter wrote:
> LS,
>
> I am currently configuring my logging configuration using a property tree.
> When I include a simple_event_log_backend sink, it does not seem possible
> (yet) to configure an event type mapping to that sink from the property
> tree. The source code does contain the following comment: "For now we use
> only the default level mapping. Will add support for configuration later."
>
> so I guess my first question would be whether such support is indeed in the
> works?

No, not yet. Currently, the only way to customize the mapping is to register a
sink factory that will create and configure the sink the way you need.

> My second question would be whether it is possible to add such a mapping
> after the sink was created and added to the core.
>
> In the documentation an example is given where the mapping is done before
> the sink is added to the core:
>
> but in the case at hand adding the sink happens behind the scenes when using
> the configuration utilities. It seems to me that there is no easy way to
> manipulate the sink in any way once it is added to the core (unless as in
> the example the shared_ptr to the sink is kept to access the sink maybe).
> Is this correct?

Technically, the sink itself allows the mapping to be set after it is added to
the core. But there is a chance that some log record is passed to the sink
before you set the new mapping. Because of this you should generally try to
configure sinks before adding them to the core.

With regard to library initialization from settings, there currently is no way
to obtain the pointer to the sink, so you won't be able to post-configure it
in the first place. This is a known limitation that I'd like to remove some
day.

> P.s. BTW, in the section "Simplified library initialization tools" of the
> documentation Table 1.15 seems to miss a 'Format' parameter that I assume
> is still needed?

Yes, you're right.


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