boost::log::basic_record_ostream — Logging record adapter with a streaming capability.
// In header: <boost/log/sources/record_ostream.hpp> template<typename CharT, typename TraitsT = std::char_traits< CharT > > class basic_record_ostream : public std::basic_ostream< CharT, TraitsT > { public: // types typedef std::basic_ostream< CharT, TraitsT > ostream_type; // Stream type. typedef basic_record< CharT > record_type; // Log record type. typedef record_type::char_type char_type; // Character type. typedef record_type::string_type string_type; // String type to be used as a message text holder. // construct/copy/destruct basic_record_ostream(); explicit basic_record_ostream(record_handle const &); basic_record_ostream(record_type const &); basic_record_ostream(basic_record_ostream const &); basic_record_ostream& operator=(basic_record_ostream const &); ~basic_record_ostream(); // public member functions bool operator!() const; record_type const & record() const; void record(record_type); // private member functions void init_stream(); void detach_from_record(); };
This class allows to compose the logging record message by streaming operations. It aggregates the log record and provides the standard output stream interface.
basic_record_ostream
public
construct/copy/destructbasic_record_ostream();
Default constructor. Creates an empty record that is equivalent to the invalid record handle. The stream capability is not available after construction.
Postconditions: |
|
explicit basic_record_ostream(record_handle const & rec);
Conversion from a record handle. Adopts the record referenced by the handle.
Parameters: |
|
||
Requires: | The handle, if valid, have been issued by the logging core with the same character type as the record being constructed. |
||
Postconditions: |
|
basic_record_ostream(record_type const & rec);
Conversion from a record object. Adopts the record referenced by the object.
Parameters: |
|
||
Requires: | The handle, if valid, have been issued by the logging core with the same character type as the record being constructed. |
||
Postconditions: |
|
basic_record_ostream(basic_record_ostream const &);
basic_record_ostream& operator=(basic_record_ostream const &);
~basic_record_ostream();
Destructor. Destroys the record, releases any sinks and attribute values that were involved in processing this record.
basic_record_ostream
public member functionsbool operator!() const;
Conversion to an unspecified boolean type
Inverted conversion to an unspecified boolean type
Returns: |
|
Returns: |
|
record_type const & record() const;
Flushes internal buffers to complete all pending formatting operations and returns the aggregated log record
Returns: | The aggregated record object |
void record(record_type rec);
If the stream is attached to a log record, flushes internal buffers to complete all pending formatting operations. Then reattaches the stream to another log record.
Parameters: |
|