]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/log/include/boost/log/sources/channel_logger.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / log / include / boost / log / sources / channel_logger.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 channel_logger.hpp
9 * \author Andrey Semashev
10 * \date 28.02.2008
11 *
12 * The header contains implementation of a logger with channel support.
13 */
14
15 #ifndef BOOST_LOG_SOURCES_CHANNEL_LOGGER_HPP_INCLUDED_
16 #define BOOST_LOG_SOURCES_CHANNEL_LOGGER_HPP_INCLUDED_
17
18 #include <boost/log/detail/config.hpp>
19 #if !defined(BOOST_LOG_NO_THREADS)
20 #include <boost/log/detail/light_rw_mutex.hpp>
21 #endif // !defined(BOOST_LOG_NO_THREADS)
22 #include <boost/log/sources/features.hpp>
23 #include <boost/log/sources/basic_logger.hpp>
24 #include <boost/log/sources/threading_models.hpp>
25 #include <boost/log/sources/channel_feature.hpp>
26 #include <boost/log/keywords/channel.hpp>
27 #include <boost/log/detail/header.hpp>
28
29 #ifdef BOOST_HAS_PRAGMA_ONCE
30 #pragma once
31 #endif
32
33 namespace boost {
34
35 BOOST_LOG_OPEN_NAMESPACE
36
37 namespace sources {
38
39 #ifndef BOOST_LOG_DOXYGEN_PASS
40
41 #ifdef BOOST_LOG_USE_CHAR
42
43 //! Narrow-char logger with channel support
44 template< typename ChannelT = std::string >
45 class channel_logger :
46 public basic_composite_logger<
47 char,
48 channel_logger< ChannelT >,
49 single_thread_model,
50 features< channel< ChannelT > >
51 >
52 {
53 typedef typename channel_logger::logger_base base_type;
54
55 public:
56 BOOST_LOG_FORWARD_LOGGER_MEMBERS_TEMPLATE(channel_logger)
57
58 explicit channel_logger(ChannelT const& channel) : base_type(keywords::channel = channel)
59 {
60 }
61 };
62
63 #if !defined(BOOST_LOG_NO_THREADS)
64
65 //! Narrow-char thread-safe logger with channel support
66 template< typename ChannelT = std::string >
67 class channel_logger_mt :
68 public basic_composite_logger<
69 char,
70 channel_logger_mt< ChannelT >,
71 multi_thread_model< boost::log::aux::light_rw_mutex >,
72 features< channel< ChannelT > >
73 >
74 {
75 typedef typename channel_logger_mt::logger_base base_type;
76
77 public:
78 BOOST_LOG_FORWARD_LOGGER_MEMBERS_TEMPLATE(channel_logger_mt)
79
80 explicit channel_logger_mt(ChannelT const& channel) : base_type(keywords::channel = channel)
81 {
82 }
83 };
84
85 #endif // !defined(BOOST_LOG_NO_THREADS)
86
87 #endif // BOOST_LOG_USE_CHAR
88
89 #ifdef BOOST_LOG_USE_WCHAR_T
90
91 //! Wide-char logger with channel support
92 template< typename ChannelT = std::wstring >
93 class wchannel_logger :
94 public basic_composite_logger<
95 wchar_t,
96 wchannel_logger< ChannelT >,
97 single_thread_model,
98 features< channel< ChannelT > >
99 >
100 {
101 typedef typename wchannel_logger::logger_base base_type;
102
103 public:
104 BOOST_LOG_FORWARD_LOGGER_MEMBERS_TEMPLATE(wchannel_logger)
105
106 explicit wchannel_logger(ChannelT const& channel) : base_type(keywords::channel = channel)
107 {
108 }
109 };
110
111 #if !defined(BOOST_LOG_NO_THREADS)
112
113 //! Wide-char thread-safe logger with channel support
114 template< typename ChannelT = std::wstring >
115 class wchannel_logger_mt :
116 public basic_composite_logger<
117 wchar_t,
118 wchannel_logger< ChannelT >,
119 multi_thread_model< boost::log::aux::light_rw_mutex >,
120 features< channel< ChannelT > >
121 >
122 {
123 typedef typename wchannel_logger_mt::logger_base base_type;
124
125 public:
126 BOOST_LOG_FORWARD_LOGGER_MEMBERS_TEMPLATE(wchannel_logger_mt)
127
128 explicit wchannel_logger_mt(ChannelT const& channel) : base_type(keywords::channel = channel)
129 {
130 }
131 };
132
133 #endif // !defined(BOOST_LOG_NO_THREADS)
134
135 #endif // BOOST_LOG_USE_WCHAR_T
136
137 #else // BOOST_LOG_DOXYGEN_PASS
138
139 /*!
140 * \brief Narrow-char logger. Functionally equivalent to \c basic_channel_logger.
141 *
142 * See \c channel class template for a more detailed description
143 */
144 template< typename ChannelT = std::string >
145 class channel_logger :
146 public basic_composite_logger<
147 char,
148 channel_logger< ChannelT >,
149 single_thread_model,
150 features< channel< ChannelT > >
151 >
152 {
153 public:
154 /*!
155 * Default constructor
156 */
157 channel_logger();
158 /*!
159 * Copy constructor
160 */
161 channel_logger(channel_logger const& that);
162 /*!
163 * Constructor with named arguments
164 */
165 template< typename... ArgsT >
166 explicit channel_logger(ArgsT... const& args);
167 /*!
168 * The constructor creates the logger with the specified channel name
169 *
170 * \param channel The channel name
171 */
172 explicit channel_logger(ChannelT const& channel);
173 /*!
174 * Assignment operator
175 */
176 channel_logger& operator= (channel_logger const& that)
177 /*!
178 * Swaps two loggers
179 */
180 void swap(channel_logger& that);
181 };
182
183 /*!
184 * \brief Narrow-char thread-safe logger. Functionally equivalent to \c basic_channel_logger.
185 *
186 * See \c channel class template for a more detailed description
187 */
188 template< typename ChannelT = std::string >
189 class channel_logger_mt :
190 public basic_composite_logger<
191 char,
192 channel_logger_mt< ChannelT >,
193 multi_thread_model< implementation_defined >,
194 features< channel< ChannelT > >
195 >
196 {
197 public:
198 /*!
199 * Default constructor
200 */
201 channel_logger_mt();
202 /*!
203 * Copy constructor
204 */
205 channel_logger_mt(channel_logger_mt const& that);
206 /*!
207 * Constructor with named arguments
208 */
209 template< typename... ArgsT >
210 explicit channel_logger_mt(ArgsT... const& args);
211 /*!
212 * The constructor creates the logger with the specified channel name
213 *
214 * \param channel The channel name
215 */
216 explicit channel_logger_mt(ChannelT const& channel);
217 /*!
218 * Assignment operator
219 */
220 channel_logger_mt& operator= (channel_logger_mt const& that)
221 /*!
222 * Swaps two loggers
223 */
224 void swap(channel_logger_mt& that);
225 };
226
227 /*!
228 * \brief Wide-char logger. Functionally equivalent to \c basic_channel_logger.
229 *
230 * See \c channel class template for a more detailed description
231 */
232 template< typename ChannelT = std::wstring >
233 class wchannel_logger :
234 public basic_composite_logger<
235 wchar_t,
236 wchannel_logger< ChannelT >,
237 single_thread_model,
238 features< channel< ChannelT > >
239 >
240 {
241 public:
242 /*!
243 * Default constructor
244 */
245 wchannel_logger();
246 /*!
247 * Copy constructor
248 */
249 wchannel_logger(wchannel_logger const& that);
250 /*!
251 * Constructor with named arguments
252 */
253 template< typename... ArgsT >
254 explicit wchannel_logger(ArgsT... const& args);
255 /*!
256 * The constructor creates the logger with the specified channel name
257 *
258 * \param channel The channel name
259 */
260 explicit wchannel_logger(ChannelT const& channel);
261 /*!
262 * Assignment operator
263 */
264 wchannel_logger& operator= (wchannel_logger const& that)
265 /*!
266 * Swaps two loggers
267 */
268 void swap(wchannel_logger& that);
269 };
270
271 /*!
272 * \brief Wide-char thread-safe logger. Functionally equivalent to \c basic_channel_logger.
273 *
274 * See \c channel class template for a more detailed description
275 */
276 template< typename ChannelT = std::wstring >
277 class wchannel_logger_mt :
278 public basic_composite_logger<
279 wchar_t,
280 wchannel_logger< ChannelT >,
281 multi_thread_model< implementation_defined >,
282 features< channel< ChannelT > >
283 >
284 {
285 public:
286 /*!
287 * Default constructor
288 */
289 wchannel_logger_mt();
290 /*!
291 * Copy constructor
292 */
293 wchannel_logger_mt(wchannel_logger_mt const& that);
294 /*!
295 * Constructor with named arguments
296 */
297 template< typename... ArgsT >
298 explicit wchannel_logger_mt(ArgsT... const& args);
299 /*!
300 * The constructor creates the logger with the specified channel name
301 *
302 * \param channel The channel name
303 */
304 explicit wchannel_logger_mt(ChannelT const& channel);
305 /*!
306 * Assignment operator
307 */
308 wchannel_logger_mt& operator= (wchannel_logger_mt const& that)
309 /*!
310 * Swaps two loggers
311 */
312 void swap(wchannel_logger_mt& that);
313 };
314
315 #endif // BOOST_LOG_DOXYGEN_PASS
316
317 } // namespace sources
318
319 BOOST_LOG_CLOSE_NAMESPACE // namespace log
320
321 } // namespace boost
322
323 #include <boost/log/detail/footer.hpp>
324
325 #endif // BOOST_LOG_SOURCES_CHANNEL_LOGGER_HPP_INCLUDED_