2 * Copyright Andrey Semashev 2007 - 2015.
3 * Distributed under the Boost Software License, Version 1.0.
4 * (See accompanying file LICENSE_1_0.txt or copy at
5 * http://www.boost.org/LICENSE_1_0.txt)
8 * \file drop_on_overflow.hpp
9 * \author Andrey Semashev
12 * The header contains implementation of \c drop_on_overflow strategy for handling
13 * queue overflows in bounded queues for the asynchronous sink frontend.
16 #ifndef BOOST_LOG_SINKS_DROP_ON_OVERFLOW_HPP_INCLUDED_
17 #define BOOST_LOG_SINKS_DROP_ON_OVERFLOW_HPP_INCLUDED_
19 #include <boost/log/detail/config.hpp>
20 #include <boost/log/core/record_view.hpp>
21 #include <boost/log/detail/header.hpp>
23 #ifdef BOOST_HAS_PRAGMA_ONCE
29 BOOST_LOG_OPEN_NAMESPACE
34 * \brief Log record dropping strategy
36 * This strategy will cause log records to be discarded in case of
37 * queue overflow in bounded asynchronous sinks. It should not be used
38 * if losing log records is not acceptable.
40 class drop_on_overflow
42 #ifndef BOOST_LOG_DOXYGEN_PASS
45 * This method is called by the queue when overflow is detected.
47 * \retval true Attempt to enqueue the record again.
48 * \retval false Discard the record.
50 template< typename LockT >
51 static bool on_overflow(record_view const&, LockT&)
57 * This method is called by the queue when there appears a free space.
59 static void on_queue_space_available()
64 * This method is called by the queue to interrupt any possible waits in \c on_overflow.
66 static void interrupt()
69 #endif // BOOST_LOG_DOXYGEN_PASS
74 BOOST_LOG_CLOSE_NAMESPACE // namespace log
78 #include <boost/log/detail/footer.hpp>
80 #endif // BOOST_LOG_SINKS_DROP_ON_OVERFLOW_HPP_INCLUDED_