## Class template basic_record_ostream

boost::log::basic_record_ostream — Logging record adapter with a streaming capability.

## Synopsis

    // In header: <boost/log/sources/record_ostream.hpp>

    template<typename CharT>
    class basic_record_ostream : public basic_formatting_ostream< CharT > {
    public:
      // types
      typedef CharT                           char_type;    // Character type.
      typedef std::basic_string< char_type >  string_type;  // String type to be used as a message text holder.
      typedef std::basic_ostream< char_type > stream_type;  // Stream type.

      // construct/copy/destruct
      basic_record_ostream() noexcept;
      explicit basic_record_ostream(record &);
      basic_record_ostream(basic_record_ostream const &);
      basic_record_ostream & operator=(basic_record_ostream const &);
      ~basic_record_ostream();

      // public member functions
      explicit operator bool() const noexcept;
      bool operator!() const noexcept;
      record & get_record();
      record const & get_record() const;
      void attach_record(record &);
      void detach_from_record() noexcept;

      // private member functions
      void init_stream();
    };

## Description

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/destruct

1.     basic_record_ostream() noexcept;

   Default constructor. Creates an empty record that is equivalent to the invalid record handle. The stream capability is not available after construction.

   Postconditions: | `!*this == true`

2.     explicit basic_record_ostream(record & rec);

   Constructor from a record object. Attaches to the provided record.

   Parameters:

   `rec` | The record handle being attached to

   Requires: | `!!rec == true`
   Postconditions: | `&this->get_record() == &rec`

3.     basic_record_ostream(basic_record_ostream const &);

4.     basic_record_ostream & operator=(basic_record_ostream const &);

5.     ~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 functions

1.     explicit operator bool() const noexcept;

   Conversion to an unspecified boolean type

   Returns: | `true`, if stream is valid and ready for formatting, `false`, if the stream is not valid. The latter also applies to the case when the stream is not attached to a log record.

2.     bool operator!() const noexcept;

   Inverted conversion to an unspecified boolean type

   Returns: | `false`, if stream is valid and ready for formatting, `true`, if the stream is not valid. The latter also applies to the case when the stream is not attached to a log record.

3.     record & get_record();

   Flushes internal buffers to complete all pending formatting operations and returns the aggregated log record

   Returns: | The aggregated record object

4.     record const & get_record() const;

   Flushes internal buffers to complete all pending formatting operations and returns the aggregated log record

   Returns: | The aggregated record object

5.     void attach_record(record & 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:

   `rec` | New log record to attach to

6.     void detach_from_record() noexcept;

   The function resets the stream into a detached (default initialized) state.

### `basic_record_ostream` private member functions

1.     void init_stream();

   The function initializes the stream and the stream buffer.