Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit 3a25068644.
PrevUpHomeNext

Class template text_ipc_message_queue_backend

boost::log::sinks::text_ipc_message_queue_backend — An implementation of a text interprocess message queue sink backend and a supporting interprocess message queue.

Synopsis

// In header: <boost/log/sinks/text_ipc_message_queue_backend.hpp>

template<typename QueueT> 
class text_ipc_message_queue_backend :
  public basic_formatted_sink_backend< char, concurrent_feeding >
{
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 QueueT                 queue_type;   // Interprocess message queue type. 

  // construct/copy/destruct
  text_ipc_message_queue_backend() noexcept;
  explicit text_ipc_message_queue_backend(queue_type &&) noexcept;
  template<typename... Args> 
    explicit text_ipc_message_queue_backend(Args &&...);

  // public member functions
  queue_type & message_queue() noexcept;
  queue_type const  & message_queue() const noexcept;
  bool is_open() const noexcept;
  void consume(record_view const &, string_type const &);
};

Description

The sink backend sends formatted log messages to an interprocess message queue which can be extracted by a viewer process. Methods of this class are not thread-safe, unless otherwise specified.

text_ipc_message_queue_backend public construct/copy/destruct

  1. text_ipc_message_queue_backend() noexcept;

    Default constructor. The method constructs the backend using the default-constructed interprocess message queue. The queue may need additional setup in order to be able to send messages.

  2. explicit text_ipc_message_queue_backend(queue_type && queue) noexcept;

    Initializing constructor. The method constructs the backend using the provided interprocess message queue. The constructor moves from the provided queue.

  3. template<typename... Args> 
      explicit text_ipc_message_queue_backend(Args &&... args);

    Constructor that passes arbitrary named parameters to the interprocess queue constructor. Refer to the queue documentation for the list of supported parameters.

text_ipc_message_queue_backend public member functions

  1. queue_type & message_queue() noexcept;

    The method returns a reference to the managed queue_type object.

    Returns:

    A reference to the managed queue_type object.

  2. queue_type const  & message_queue() const noexcept;

    The method returns a constant reference to the managed queue_type object.

    Returns:

    A constant reference to the managed queue_type object.

  3. bool is_open() const noexcept;

    Tests whether the object is associated with any message queue. Only when the backend has an associated message queue, will any message be sent.

    Returns:

    true if the object is associated with a message queue, and false otherwise.

  4. void consume(record_view const &, string_type const & formatted_message);

    The method writes the message to the backend. Concurrent calls to this method are allowed. Therefore, the backend may be used with unlocked frontend. stop_local() can be used to have a blocked consume() call return and prevent future calls to consume() from blocking.


PrevUpHomeNext