Chris@16: /* Chris@101: * Copyright Andrey Semashev 2007 - 2015. Chris@16: * Distributed under the Boost Software License, Version 1.0. Chris@16: * (See accompanying file LICENSE_1_0.txt or copy at Chris@16: * http://www.boost.org/LICENSE_1_0.txt) Chris@16: */ Chris@16: /*! Chris@16: * \file drop_on_overflow.hpp Chris@16: * \author Andrey Semashev Chris@16: * \date 04.01.2012 Chris@16: * Chris@16: * The header contains implementation of \c drop_on_overflow strategy for handling Chris@16: * queue overflows in bounded queues for the asynchronous sink frontend. Chris@16: */ Chris@16: Chris@16: #ifndef BOOST_LOG_SINKS_DROP_ON_OVERFLOW_HPP_INCLUDED_ Chris@16: #define BOOST_LOG_SINKS_DROP_ON_OVERFLOW_HPP_INCLUDED_ Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #ifdef BOOST_HAS_PRAGMA_ONCE Chris@16: #pragma once Chris@16: #endif Chris@16: Chris@16: namespace boost { Chris@16: Chris@16: BOOST_LOG_OPEN_NAMESPACE Chris@16: Chris@16: namespace sinks { Chris@16: Chris@16: /*! Chris@16: * \brief Log record dropping strategy Chris@16: * Chris@16: * This strategy will cause log records to be discarded in case of Chris@16: * queue overflow in bounded asynchronous sinks. It should not be used Chris@16: * if losing log records is not acceptable. Chris@16: */ Chris@16: class drop_on_overflow Chris@16: { Chris@16: #ifndef BOOST_LOG_DOXYGEN_PASS Chris@16: public: Chris@16: /*! Chris@16: * This method is called by the queue when overflow is detected. Chris@16: * Chris@16: * \retval true Attempt to enqueue the record again. Chris@16: * \retval false Discard the record. Chris@16: */ Chris@16: template< typename LockT > Chris@16: static bool on_overflow(record_view const&, LockT&) Chris@16: { Chris@16: return false; Chris@16: } Chris@16: Chris@16: /*! Chris@16: * This method is called by the queue when there appears a free space. Chris@16: */ Chris@16: static void on_queue_space_available() Chris@16: { Chris@16: } Chris@16: Chris@16: /*! Chris@16: * This method is called by the queue to interrupt any possible waits in \c on_overflow. Chris@16: */ Chris@16: static void interrupt() Chris@16: { Chris@16: } Chris@16: #endif // BOOST_LOG_DOXYGEN_PASS Chris@16: }; Chris@16: Chris@16: } // namespace sinks Chris@16: Chris@16: BOOST_LOG_CLOSE_NAMESPACE // namespace log Chris@16: Chris@16: } // namespace boost Chris@16: Chris@16: #include Chris@16: Chris@16: #endif // BOOST_LOG_SINKS_DROP_ON_OVERFLOW_HPP_INCLUDED_