]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/log/include/boost/log/sinks/drop_on_overflow.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / log / include / boost / log / sinks / drop_on_overflow.hpp
1 /*
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)
6 */
7 /*!
8 * \file drop_on_overflow.hpp
9 * \author Andrey Semashev
10 * \date 04.01.2012
11 *
12 * The header contains implementation of \c drop_on_overflow strategy for handling
13 * queue overflows in bounded queues for the asynchronous sink frontend.
14 */
15
16 #ifndef BOOST_LOG_SINKS_DROP_ON_OVERFLOW_HPP_INCLUDED_
17 #define BOOST_LOG_SINKS_DROP_ON_OVERFLOW_HPP_INCLUDED_
18
19 #include <boost/log/detail/config.hpp>
20 #include <boost/log/core/record_view.hpp>
21 #include <boost/log/detail/header.hpp>
22
23 #ifdef BOOST_HAS_PRAGMA_ONCE
24 #pragma once
25 #endif
26
27 namespace boost {
28
29 BOOST_LOG_OPEN_NAMESPACE
30
31 namespace sinks {
32
33 /*!
34 * \brief Log record dropping strategy
35 *
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.
39 */
40 class drop_on_overflow
41 {
42 #ifndef BOOST_LOG_DOXYGEN_PASS
43 public:
44 /*!
45 * This method is called by the queue when overflow is detected.
46 *
47 * \retval true Attempt to enqueue the record again.
48 * \retval false Discard the record.
49 */
50 template< typename LockT >
51 static bool on_overflow(record_view const&, LockT&)
52 {
53 return false;
54 }
55
56 /*!
57 * This method is called by the queue when there appears a free space.
58 */
59 static void on_queue_space_available()
60 {
61 }
62
63 /*!
64 * This method is called by the queue to interrupt any possible waits in \c on_overflow.
65 */
66 static void interrupt()
67 {
68 }
69 #endif // BOOST_LOG_DOXYGEN_PASS
70 };
71
72 } // namespace sinks
73
74 BOOST_LOG_CLOSE_NAMESPACE // namespace log
75
76 } // namespace boost
77
78 #include <boost/log/detail/footer.hpp>
79
80 #endif // BOOST_LOG_SINKS_DROP_ON_OVERFLOW_HPP_INCLUDED_