Boost logo

Boost Users :

Subject: [Boost-users] [Log] Get the streams in a text_ostream_backend derived class
From: Florian Lindner (mailinglists_at_[hidden])
Date: 2016-06-16 04:41:02


Hello,

I have

class StreamBackend : public boost::log::sinks::text_ostream_backend

and manually instantiate the backend and add a stream

boost::shared_ptr<StreamBackend> backend =
boost::make_shared<StreamBackend>();

backend->add_stream(boost::shared_ptr<std::ostream>(new
std::ofstream(some file name)));

using sink_t = boost::log::sinks::synchronous_sink<StreamBackend>;

boost::shared_ptr<sink_t> sink(new sink_t(backend));
sink->set_formatter(config.second.format);
sink->set_filter(config.second.filter);
boost::log::core::get()->add_sink(sink);

All I want is to overwrite the consume function in the derived class.
Since I want to retain the original functionality as far as possible, I
would like to work on the streams added add_streams. Problem is that the
m_pImpl->m_Streams vector in the implementation is private and there is
no method to get the added streams.

What is the best way to go here?

Thanks,
Florian


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