...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::log::sinks::basic_text_ostream_backend — An implementation of a text output stream logging sink backend.
// In header: <boost/log/sinks/text_ostream_backend.hpp> template<typename CharT> class basic_text_ostream_backend : public basic_formatted_sink_backend< CharT, combine_requirements< synchronized_feeding, flushing >::type > { public: // types typedef base_type::char_type char_type; // Character type. typedef base_type::string_type string_type; // String type to be used as a message text holder. typedef std::basic_ostream< char_type > stream_type; // Output stream type. // construct/copy/destruct basic_text_ostream_backend(); ~basic_text_ostream_backend(); // public member functions void add_stream(shared_ptr< stream_type > const &); void remove_stream(shared_ptr< stream_type > const &); void auto_flush(bool = true); void consume(record_view const &, string_type const &); void flush(); };
The sink backend puts formatted log records to one or more text streams.
basic_text_ostream_backend
public member functionsvoid add_stream(shared_ptr< stream_type > const & strm);
The method adds a new stream to the sink.
Parameters: |
|
void remove_stream(shared_ptr< stream_type > const & strm);
The method removes a stream from the sink. If the stream is not attached to the sink, the method has no effect.
Parameters: |
|
void auto_flush(bool f = true);
Sets the flag to automatically flush buffers of all attached streams after each log record
void consume(record_view const & rec, string_type const & formatted_message);
The method writes the message to the sink
void flush();
The method flushes the associated streams