## Class template synchronous_sink

boost::log::sinks::synchronous_sink — Synchronous logging sink frontend.

## Synopsis

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

    template<typename SinkBackendT>
    class synchronous_sink : public basic_sink_frontend {
    public:
      // types
      typedef SinkBackendT           sink_backend_type;   // Sink implementation type.
      typedef implementation_defined locked_backend_ptr;  // A pointer type that locks the backend until it's destroyed.

      // public member functions
      synchronous_sink();
      explicit synchronous_sink(shared_ptr< sink_backend_type > const &);
      template<typename... Args> explicit synchronous_sink(Args &&...);
      locked_backend_ptr locked_backend();
      virtual void consume(record_view const &);
      virtual bool try_consume(record_view const &);
      virtual void flush();
    };

## Description

The sink frontend serializes threads before passing logging records to the backend

### `synchronous_sink` public member functions

1.     synchronous_sink();

   Default constructor. Constructs the sink backend instance. Requires the backend to be default-constructible.

2.     explicit synchronous_sink(shared_ptr< sink_backend_type > const & backend);

   Constructor attaches user-constructed backend instance

   Parameters:

   `backend` | Pointer to the backend instance

   Requires: | backend is not `NULL`.

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

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

4.     locked_backend_ptr locked_backend();

   Locking accessor to the attached backend

5.     virtual void consume(record_view const & rec);

   Passes the log record to the backend

6.     virtual bool try_consume(record_view const & rec);

   The method attempts to pass logging record to the backend

7.     virtual void flush();

   The method performs flushing of any internal buffers that may hold log records. The method may take considerable time to complete and may block both the calling thread and threads attempting to put new records into the sink while this call is in progress.