Boost logo

Boost :

Subject: Re: [boost] boost.log
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2010-05-31 11:48:38


On 05/31/2010 04:34 PM, Dirk Griffioen wrote:
> Hi,
>
> I have a small question regarding boost.log: would it be possible to
> 'register' different outputfiles for different loggers?
>
> BOOST_LOG(get_normal_log()) << msg; // goes to 'normal.log'
> BOOST_LOG(get_special_log()) << msg; // goes to 'special.log'

Filtering is the key. If each of your loggers has an attribute with a
unique value, you can write filters that will pass records from the
particular loggers to the particular sinks. That way you can create
several file sinks that will write records from their respective loggers.

Alternatively, you can use the multi-file sink [1]. In that case you
only need one sink, which will distribute records to different files,
which names will be based on the attribute values attached to the record.

[1]
<http://boost-log.sourceforge.net/libs/log/doc/html/log/detailed/sink_backends.html#log.detailed.sink_backends.text_multifile>


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