## Class sink

boost::log::sinks::sink — A base class for a logging sink frontend.

## Synopsis

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

    class sink {
    public:
      // types
      typedef unspecified exception_handler_type;  // An exception handler type.

      // public member functions
      explicit sink(bool);
      virtual ~sink();
      virtual bool will_consume(attribute_value_set const &) = 0;
      virtual void consume(record_view const &) = 0;
      virtual bool try_consume(record_view const &);
      virtual void flush() = 0;
      bool is_cross_thread() const noexcept;
      sink(sink const &) = delete;
      sink & operator=(sink const &) = delete;
    };

## Description

### `sink` public member functions

1.     explicit sink(bool cross_thread);

   Default constructor

2.     virtual ~sink();

   Virtual destructor

3.     virtual bool will_consume(attribute_value_set const & attributes) = 0;

   The method returns `true` if no filter is set or the attribute values pass the filter

   Parameters: |
   `attributes` | A set of attribute values of a logging record

4.     virtual void consume(record_view const & rec) = 0;

   The method puts logging record to the sink

   Parameters: |
   `rec` | Logging record to consume

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

   The method attempts to put logging record to the sink. The method may be used by the core in order to determine the most efficient order of sinks to feed records to in case of heavy contention. Sink implementations may implement try/backoff logic in order to improve overall logging throughput.

   Parameters: |
   `rec` | Logging record to consume
   Returns: | `true`, if the record was consumed, `false`, if not.

6.     virtual void flush() = 0;

   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.

7.     bool is_cross_thread() const noexcept;

   The method indicates that the sink passes log records between different threads. This information is needed by the logging core to detach log records from all thread-specific resources before passing it to the sink.

8.     sink(sink const &) = delete;

9.     sink & operator=(sink const &) = delete;