## 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.

      // construct/copy/destruct
      explicit sink(bool);
      sink(sink const &) = delete;
      sink& operator=(sink const &) = delete;
      ~sink();

      // public member functions
      bool will_consume(attribute_value_set const &);
      void consume(record_view const &);
      bool try_consume(record_view const &);
      void flush();
      bool is_cross_thread() const;
    };

## Description

### `sink` public construct/copy/destruct

1.     explicit sink(bool cross_thread);

   Default constructor

2.     sink(sink const &) = delete;

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

4.     ~sink();

   Virtual destructor

### `sink` public member functions

1.     bool will_consume(attribute_value_set const & attributes);

   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

2.     void consume(record_view const & rec);

   The method puts logging record to the sink

   Parameters: |
   `rec` | Logging record to consume

3.     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.

4.     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.

5.     bool is_cross_thread() const;

   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.