/builds/MusicScience37Projects/numerical-analysis/numerical-collection-cpp/include/num_collect/logging/logger.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright 2022 MusicScience37 (Kenta Kabashima) |
3 | | * |
4 | | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | | * you may not use this file except in compliance with the License. |
6 | | * You may obtain a copy of the License at |
7 | | * |
8 | | * http://www.apache.org/licenses/LICENSE-2.0 |
9 | | * |
10 | | * Unless required by applicable law or agreed to in writing, software |
11 | | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | | * See the License for the specific language governing permissions and |
14 | | * limitations under the License. |
15 | | */ |
16 | | /*! |
17 | | * \file |
18 | | * \brief Definition of logger class. |
19 | | */ |
20 | | #pragma once |
21 | | |
22 | | #include <algorithm> |
23 | | #include <iterator> |
24 | | #include <string> |
25 | | #include <string_view> |
26 | | #include <utility> |
27 | | |
28 | | #include <fmt/base.h> |
29 | | #include <fmt/format.h> |
30 | | |
31 | | #include "num_collect/logging/impl/iteration_layer_handler.h" |
32 | | #include "num_collect/logging/log_config.h" |
33 | | #include "num_collect/logging/log_level.h" |
34 | | #include "num_collect/logging/log_tag.h" |
35 | | #include "num_collect/logging/log_tag_config.h" |
36 | | #include "num_collect/logging/log_tag_view.h" |
37 | | #include "num_collect/logging/sinks/log_sink.h" |
38 | | #include "num_collect/logging/time_stamp.h" |
39 | | #include "num_collect/util/source_info_view.h" |
40 | | |
41 | | namespace num_collect::logging { |
42 | | |
43 | | /*! |
44 | | * \brief Proxy class to write logs. |
45 | | * |
46 | | * \warning This class is assumed to be used only as an temporary object |
47 | | * returned from num_collect::logging::logger class. |
48 | | */ |
49 | | class logging_proxy { |
50 | | public: |
51 | | /*! |
52 | | * \brief Constructor. |
53 | | * |
54 | | * \param[in] tag Tag. |
55 | | * \param[in] level Log level. |
56 | | * \param[in] source Information of the source code. |
57 | | * \param[in] sink Log sink. |
58 | | * \param[in] write_log Whether to write log. |
59 | | */ |
60 | | logging_proxy(std::string_view tag, log_level level, |
61 | | util::source_info_view source, const sinks::log_sink* sink, |
62 | | bool write_log) noexcept |
63 | 23.1k | : tag_(tag), |
64 | 23.1k | level_(level), |
65 | 23.1k | source_(source), |
66 | 23.1k | sink_(sink), |
67 | 23.1k | write_log_(write_log) {} |
68 | | |
69 | | /*! |
70 | | * \brief Write a log. |
71 | | * |
72 | | * \param[in] body Body. |
73 | | */ |
74 | 6.21k | void operator()(std::string_view body) const { |
75 | 6.21k | if (!write_log_) { |
76 | 11 | return; |
77 | 11 | } |
78 | | |
79 | 6.19k | sink_->write(time_stamp::now(), tag_, level_, source_, body); |
80 | 6.19k | } |
81 | | |
82 | | /*! |
83 | | * \brief Write a log. |
84 | | * |
85 | | * \tparam Args Type of arguments. |
86 | | * \param[in] format Format string. |
87 | | * \param[in] args Arguments for the format string. |
88 | | */ |
89 | | template <typename... Args> |
90 | | requires(sizeof...(Args) > 0) |
91 | 16.9k | void operator()(fmt::format_string<Args...> format, Args&&... args) const { |
92 | 16.9k | if (!write_log_) { |
93 | 1 | return; |
94 | 1 | } |
95 | | |
96 | 16.9k | fmt::memory_buffer buffer; |
97 | 16.9k | fmt::format_to( |
98 | 16.9k | std::back_inserter(buffer), format, std::forward<Args>(args)...); |
99 | 16.9k | sink_->write(time_stamp::now(), tag_, level_, source_, |
100 | 16.9k | std::string_view{buffer.data(), buffer.size()}); |
101 | 16.9k | } _ZNK11num_collect7logging13logging_proxyclIJRKdEQgtsZT_Li0EEEvN3fmt3v1119basic_format_stringIcJDpNS6_13type_identityIT_E4typeEEEEDpOS9_ Line | Count | Source | 91 | 11 | void operator()(fmt::format_string<Args...> format, Args&&... args) const { | 92 | 11 | if (!write_log_) { | 93 | 0 | return; | 94 | 0 | } | 95 | | | 96 | 11 | fmt::memory_buffer buffer; | 97 | 11 | fmt::format_to( | 98 | 11 | std::back_inserter(buffer), format, std::forward<Args>(args)...); | 99 | 11 | sink_->write(time_stamp::now(), tag_, level_, source_, | 100 | 11 | std::string_view{buffer.data(), buffer.size()}); | 101 | 11 | } |
_ZNK11num_collect7logging13logging_proxyclIJRKiS4_EQgtsZT_Li0EEEvN3fmt3v1119basic_format_stringIcJDpNS6_13type_identityIT_E4typeEEEEDpOS9_ Line | Count | Source | 91 | 18 | void operator()(fmt::format_string<Args...> format, Args&&... args) const { | 92 | 18 | if (!write_log_) { | 93 | 0 | return; | 94 | 0 | } | 95 | | | 96 | 18 | fmt::memory_buffer buffer; | 97 | 18 | fmt::format_to( | 98 | 18 | std::back_inserter(buffer), format, std::forward<Args>(args)...); | 99 | 18 | sink_->write(time_stamp::now(), tag_, level_, source_, | 100 | 18 | std::string_view{buffer.data(), buffer.size()}); | 101 | 18 | } |
_ZNK11num_collect7logging13logging_proxyclIJRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEEQgtsZT_Li0EEEvN3fmt3v1119basic_format_stringIcJDpNSD_13type_identityIT_E4typeEEEEDpOSG_ Line | Count | Source | 91 | 11.4k | void operator()(fmt::format_string<Args...> format, Args&&... args) const { | 92 | 11.4k | if (!write_log_) { | 93 | 0 | return; | 94 | 0 | } | 95 | | | 96 | 11.4k | fmt::memory_buffer buffer; | 97 | 11.4k | fmt::format_to( | 98 | 11.4k | std::back_inserter(buffer), format, std::forward<Args>(args)...); | 99 | 11.4k | sink_->write(time_stamp::now(), tag_, level_, source_, | 100 | 11.4k | std::string_view{buffer.data(), buffer.size()}); | 101 | 11.4k | } |
_ZNK11num_collect7logging13logging_proxyclIJRKmS4_EQgtsZT_Li0EEEvN3fmt3v1119basic_format_stringIcJDpNS6_13type_identityIT_E4typeEEEEDpOS9_ Line | Count | Source | 91 | 5.48k | void operator()(fmt::format_string<Args...> format, Args&&... args) const { | 92 | 5.48k | if (!write_log_) { | 93 | 0 | return; | 94 | 0 | } | 95 | | | 96 | 5.48k | fmt::memory_buffer buffer; | 97 | 5.48k | fmt::format_to( | 98 | 5.48k | std::back_inserter(buffer), format, std::forward<Args>(args)...); | 99 | 5.48k | sink_->write(time_stamp::now(), tag_, level_, source_, | 100 | 5.48k | std::string_view{buffer.data(), buffer.size()}); | 101 | 5.48k | } |
_ZNK11num_collect7logging13logging_proxyclIJRKiEQgtsZT_Li0EEEvN3fmt3v1119basic_format_stringIcJDpNS6_13type_identityIT_E4typeEEEEDpOS9_ Line | Count | Source | 91 | 3 | void operator()(fmt::format_string<Args...> format, Args&&... args) const { | 92 | 3 | if (!write_log_) { | 93 | 0 | return; | 94 | 0 | } | 95 | | | 96 | 3 | fmt::memory_buffer buffer; | 97 | 3 | fmt::format_to( | 98 | 3 | std::back_inserter(buffer), format, std::forward<Args>(args)...); | 99 | 3 | sink_->write(time_stamp::now(), tag_, level_, source_, | 100 | 3 | std::string_view{buffer.data(), buffer.size()}); | 101 | 3 | } |
_ZNK11num_collect7logging13logging_proxyclIJN3fmt3v119join_viewINSt3__111__wrap_iterIPKdEESA_cEERKNS6_17basic_string_viewIcNS6_11char_traitsIcEEEEEQgtsZT_Li0EEEvNS4_19basic_format_stringIcJDpNS4_13type_identityIT_E4typeEEEEDpOSK_ Line | Count | Source | 91 | 3 | void operator()(fmt::format_string<Args...> format, Args&&... args) const { | 92 | 3 | if (!write_log_) { | 93 | 0 | return; | 94 | 0 | } | 95 | | | 96 | 3 | fmt::memory_buffer buffer; | 97 | 3 | fmt::format_to( | 98 | 3 | std::back_inserter(buffer), format, std::forward<Args>(args)...); | 99 | 3 | sink_->write(time_stamp::now(), tag_, level_, source_, | 100 | 3 | std::string_view{buffer.data(), buffer.size()}); | 101 | 3 | } |
_ZNK11num_collect7logging13logging_proxyclIJRA16_KciEQgtsZT_Li0EEEvN3fmt3v1119basic_format_stringIcJDpNS7_13type_identityIT_E4typeEEEEDpOSA_ Line | Count | Source | 91 | 1 | void operator()(fmt::format_string<Args...> format, Args&&... args) const { | 92 | 1 | if (!write_log_) { | 93 | 0 | return; | 94 | 0 | } | 95 | | | 96 | 1 | fmt::memory_buffer buffer; | 97 | 1 | fmt::format_to( | 98 | 1 | std::back_inserter(buffer), format, std::forward<Args>(args)...); | 99 | 1 | sink_->write(time_stamp::now(), tag_, level_, source_, | 100 | 1 | std::string_view{buffer.data(), buffer.size()}); | 101 | 1 | } |
_ZNK11num_collect7logging13logging_proxyclIJiEQgtsZT_Li0EEEvN3fmt3v1119basic_format_stringIcJDpNS4_13type_identityIT_E4typeEEEEDpOS7_ Line | Count | Source | 91 | 1 | void operator()(fmt::format_string<Args...> format, Args&&... args) const { | 92 | 1 | if (!write_log_) { | 93 | 1 | return; | 94 | 1 | } | 95 | | | 96 | 0 | fmt::memory_buffer buffer; | 97 | 0 | fmt::format_to( | 98 | 0 | std::back_inserter(buffer), format, std::forward<Args>(args)...); | 99 | 0 | sink_->write(time_stamp::now(), tag_, level_, source_, | 100 | 0 | std::string_view{buffer.data(), buffer.size()}); | 101 | 0 | } |
_ZNK11num_collect7logging13logging_proxyclIJNS_4util4impl24dense_vector_format_viewIN5Eigen6MatrixIdLin1ELi1ELi0ELin1ELi1EEEEEEQgtsZT_Li0EEEvN3fmt3v1119basic_format_stringIcJDpNSB_13type_identityIT_E4typeEEEEDpOSE_ Line | Count | Source | 91 | 1 | void operator()(fmt::format_string<Args...> format, Args&&... args) const { | 92 | 1 | if (!write_log_) { | 93 | 0 | return; | 94 | 0 | } | 95 | | | 96 | 1 | fmt::memory_buffer buffer; | 97 | 1 | fmt::format_to( | 98 | 1 | std::back_inserter(buffer), format, std::forward<Args>(args)...); | 99 | 1 | sink_->write(time_stamp::now(), tag_, level_, source_, | 100 | 1 | std::string_view{buffer.data(), buffer.size()}); | 101 | 1 | } |
|
102 | | |
103 | | private: |
104 | | //! Tag. |
105 | | std::string_view tag_; |
106 | | |
107 | | //! Log level. |
108 | | log_level level_; |
109 | | |
110 | | //! Information of the source code. |
111 | | util::source_info_view source_; |
112 | | |
113 | | //! Log sink. |
114 | | const sinks::log_sink* sink_; |
115 | | |
116 | | //! Whether to write log. |
117 | | bool write_log_; |
118 | | }; |
119 | | |
120 | | /*! |
121 | | * \brief Default log tag. |
122 | | */ |
123 | | constexpr auto default_tag = log_tag_view(""); |
124 | | |
125 | | /*! |
126 | | * \brief Class of loggers. |
127 | | * |
128 | | * \thread_safety All `const` member functions (member functions except for |
129 | | * initialize_child_algorithm_logger function, constructors, destructor, and |
130 | | * assignment operators) are thread safe even for the same object. |
131 | | * |
132 | | * For logging, following macros can be used: |
133 | | * |
134 | | * - \ref NUM_COLLECT_LOG_TRACE |
135 | | * - \ref NUM_COLLECT_LOG_DEBUG |
136 | | * - \ref NUM_COLLECT_LOG_ITERATION |
137 | | * - \ref NUM_COLLECT_LOG_ITERATION_LABEL |
138 | | * - \ref NUM_COLLECT_LOG_SUMMARY |
139 | | * - \ref NUM_COLLECT_LOG_INFO |
140 | | * - \ref NUM_COLLECT_LOG_WARNING |
141 | | * - \ref NUM_COLLECT_LOG_ERROR |
142 | | * - \ref NUM_COLLECT_LOG_CRITICAL |
143 | | * - \ref NUM_COLLECT_LOG_AND_THROW |
144 | | */ |
145 | | class logger { |
146 | | public: |
147 | | /*! |
148 | | * \brief Constructor. |
149 | | */ |
150 | 112 | logger() : logger(default_tag) {} |
151 | | |
152 | | /*! |
153 | | * \brief Constructor. |
154 | | * |
155 | | * \param[in] tag Tag. |
156 | | */ |
157 | 863 | explicit logger(log_tag_view tag) : logger(tag, get_config_of(tag)) {} |
158 | | |
159 | | /*! |
160 | | * \brief Constructor. |
161 | | * |
162 | | * \param[in] tag Tag. |
163 | | * \param[in] config Configuration. |
164 | | */ |
165 | | logger(log_tag_view tag, log_tag_config config) |
166 | 880 | : logger(static_cast<log_tag>(tag), std::move(config)) {} |
167 | | |
168 | | /*! |
169 | | * \brief Constructor. |
170 | | * |
171 | | * \param[in] tag Tag. |
172 | | * \param[in] config Configuration. |
173 | | */ |
174 | | logger(log_tag tag, log_tag_config config) |
175 | 880 | : tag_(std::move(tag)), |
176 | 880 | config_(std::move(config)), |
177 | 880 | always_output_log_level_(std::max(config_.output_log_level(), |
178 | 880 | config_.output_log_level_in_child_iterations())), |
179 | 880 | lowest_output_log_level_(std::min(config_.output_log_level(), |
180 | 880 | config_.output_log_level_in_child_iterations())) {} |
181 | | |
182 | | /*! |
183 | | * \brief Get the log tag. |
184 | | * |
185 | | * \return Log tag. |
186 | | */ |
187 | 311 | [[nodiscard]] auto tag() const noexcept -> const log_tag& { return tag_; } |
188 | | |
189 | | /*! |
190 | | * \brief Get the configuration. |
191 | | * |
192 | | * \return Configuration. |
193 | | */ |
194 | 935 | [[nodiscard]] auto config() const noexcept -> const log_tag_config& { |
195 | 935 | return config_; |
196 | 935 | } |
197 | | |
198 | | /*! |
199 | | * \brief Set this node to an iterative algorithm. |
200 | | */ |
201 | 380 | void set_iterative() const noexcept { |
202 | 380 | iteration_layer_handler_.set_iterative(); |
203 | 380 | } |
204 | | |
205 | | /*! |
206 | | * \brief Initialize a logger as the logger of the algorithm called from the |
207 | | * algorithm of this logger. |
208 | | * |
209 | | * \param[in] child Logger of the algorithm called from the algorithm of |
210 | | * this logger. |
211 | | */ |
212 | 95 | void initialize_child_algorithm_logger(logger& child) noexcept { |
213 | 95 | iteration_layer_handler_.initialize_lower_layer( |
214 | 95 | child.iteration_layer_handler_); |
215 | 95 | } |
216 | | |
217 | | /*! |
218 | | * \brief Check whether to write logs with a log level. |
219 | | * |
220 | | * \param[in] level Log level. |
221 | | * \retval true Should write logs. |
222 | | * \retval false Should not write logs. |
223 | | */ |
224 | 60.4k | [[nodiscard]] auto should_log(log_level level) const noexcept -> bool { |
225 | 60.4k | if (level < lowest_output_log_level_) { |
226 | 22 | return false; |
227 | 22 | } |
228 | 60.3k | if (level >= always_output_log_level_) { |
229 | 24.2k | return true; |
230 | 24.2k | } |
231 | 36.0k | if (iteration_layer_handler_.is_upper_layer_iterative()) { |
232 | 24.9k | return level >= config_.output_log_level_in_child_iterations(); |
233 | 24.9k | } |
234 | 11.1k | return level >= config_.output_log_level(); |
235 | 36.0k | } |
236 | | |
237 | | /*! |
238 | | * \brief Write a log. |
239 | | * |
240 | | * \param[in] level Log level. |
241 | | * \param[in] source Information of the source code. |
242 | | * \return Proxy object to write log. |
243 | | * |
244 | | * \note Argument source should be left to be the default value if you want |
245 | | * to write logs with the current position. |
246 | | */ |
247 | | [[nodiscard]] auto log(log_level level, |
248 | | util::source_info_view source = util::source_info_view()) const noexcept |
249 | 23.1k | -> logging_proxy { |
250 | 23.1k | return logging_proxy( |
251 | 23.1k | tag_.name(), level, source, &config_.sink(), should_log(level)); |
252 | 23.1k | } |
253 | | |
254 | | /*! |
255 | | * \brief Write a trace log. |
256 | | * |
257 | | * \param[in] source Information of the source code. |
258 | | * \return Proxy object to write log. |
259 | | * |
260 | | * \note Argument source should be left to be the default value if you want |
261 | | * to write logs with the current position. |
262 | | */ |
263 | | [[nodiscard]] auto trace( |
264 | | util::source_info_view source = util::source_info_view()) const noexcept |
265 | 10 | -> logging_proxy { |
266 | 10 | return log(log_level::trace, source); |
267 | 10 | } |
268 | | |
269 | | /*! |
270 | | * \brief Write a debug log. |
271 | | * |
272 | | * \param[in] source Information of the source code. |
273 | | * \return Proxy object to write log. |
274 | | * |
275 | | * \note Argument source should be left to be the default value if you want |
276 | | * to write logs with the current position. |
277 | | */ |
278 | | [[nodiscard]] auto debug( |
279 | | util::source_info_view source = util::source_info_view()) const noexcept |
280 | 10 | -> logging_proxy { |
281 | 10 | return log(log_level::debug, source); |
282 | 10 | } |
283 | | |
284 | | /*! |
285 | | * \brief Write a iteration log. |
286 | | * |
287 | | * \param[in] source Information of the source code. |
288 | | * \return Proxy object to write log. |
289 | | * |
290 | | * \note Argument source should be left to be the default value if you want |
291 | | * to write logs with the current position. |
292 | | * \note This class don't take configurations of periods into account. |
293 | | */ |
294 | | [[nodiscard]] auto iteration( |
295 | | util::source_info_view source = util::source_info_view()) const noexcept |
296 | 10 | -> logging_proxy { |
297 | 10 | return log(log_level::iteration, source); |
298 | 10 | } |
299 | | |
300 | | /*! |
301 | | * \brief Write a label of iteration logs. |
302 | | * |
303 | | * \param[in] source Information of the source code. |
304 | | * \return Proxy object to write log. |
305 | | * |
306 | | * \note Argument source should be left to be the default value if you want |
307 | | * to write logs with the current position. |
308 | | * \note This class don't take configurations of periods into account. |
309 | | */ |
310 | | [[nodiscard]] auto iteration_label( |
311 | | util::source_info_view source = util::source_info_view()) const noexcept |
312 | 10 | -> logging_proxy { |
313 | 10 | return log(log_level::iteration_label, source); |
314 | 10 | } |
315 | | |
316 | | /*! |
317 | | * \brief Write a summary log. |
318 | | * |
319 | | * \param[in] source Information of the source code. |
320 | | * \return Proxy object to write log. |
321 | | * |
322 | | * \note Argument source should be left to be the default value if you want |
323 | | * to write logs with the current position. |
324 | | * \note This class don't take configurations of periods into account. |
325 | | */ |
326 | | [[nodiscard]] auto summary( |
327 | | util::source_info_view source = util::source_info_view()) const noexcept |
328 | 11 | -> logging_proxy { |
329 | 11 | return log(log_level::summary, source); |
330 | 11 | } |
331 | | |
332 | | /*! |
333 | | * \brief Write a information log. |
334 | | * |
335 | | * \param[in] source Information of the source code. |
336 | | * \return Proxy object to write log. |
337 | | * |
338 | | * \note Argument source should be left to be the default value if you want |
339 | | * to write logs with the current position. |
340 | | */ |
341 | | [[nodiscard]] auto info( |
342 | | util::source_info_view source = util::source_info_view()) const noexcept |
343 | 23.0k | -> logging_proxy { |
344 | 23.0k | return log(log_level::info, source); |
345 | 23.0k | } |
346 | | |
347 | | /*! |
348 | | * \brief Write a warning log. |
349 | | * |
350 | | * \param[in] source Information of the source code. |
351 | | * \return Proxy object to write log. |
352 | | * |
353 | | * \note Argument source should be left to be the default value if you want |
354 | | * to write logs with the current position. |
355 | | */ |
356 | | [[nodiscard]] auto warning( |
357 | | util::source_info_view source = util::source_info_view()) const noexcept |
358 | 7 | -> logging_proxy { |
359 | 7 | return log(log_level::warning, source); |
360 | 7 | } |
361 | | |
362 | | /*! |
363 | | * \brief Write a error log. |
364 | | * |
365 | | * \param[in] source Information of the source code. |
366 | | * \return Proxy object to write log. |
367 | | * |
368 | | * \note Argument source should be left to be the default value if you want |
369 | | * to write logs with the current position. |
370 | | */ |
371 | | [[nodiscard]] auto error( |
372 | | util::source_info_view source = util::source_info_view()) const noexcept |
373 | 88 | -> logging_proxy { |
374 | 88 | return log(log_level::error, source); |
375 | 88 | } |
376 | | |
377 | | /*! |
378 | | * \brief Write a critical log. |
379 | | * |
380 | | * \param[in] source Information of the source code. |
381 | | * \return Proxy object to write log. |
382 | | * |
383 | | * \note Argument source should be left to be the default value if you want |
384 | | * to write logs with the current position. |
385 | | */ |
386 | | [[nodiscard]] auto critical( |
387 | | util::source_info_view source = util::source_info_view()) const noexcept |
388 | 7 | -> logging_proxy { |
389 | 7 | return log(log_level::critical, source); |
390 | 7 | } |
391 | | |
392 | | /*! |
393 | | * \brief Write a log without check of the condition to write logs. |
394 | | * |
395 | | * \warning This function should be used with should_log() function. |
396 | | * |
397 | | * \param[in] source Information of the source code. |
398 | | * \param[in] level Log level. |
399 | | * \param[in] body Body. |
400 | | */ |
401 | | void log_without_condition_check(util::source_info_view source, |
402 | 148 | log_level level, std::string_view body) const { |
403 | 148 | config_.sink().write( |
404 | 148 | time_stamp::now(), tag_.name(), level, source, body); |
405 | 148 | } |
406 | | |
407 | | /*! |
408 | | * \brief Write a log without check of the condition to write logs. |
409 | | * |
410 | | * \warning This function should be used with should_log() function. |
411 | | * |
412 | | * \tparam Args Type of arguments. |
413 | | * \param[in] source Information of the source code. |
414 | | * \param[in] level Log level. |
415 | | * \param[in] format Format string. |
416 | | * \param[in] args Arguments for the format string. |
417 | | */ |
418 | | template <typename... Args> |
419 | | requires(sizeof...(Args) > 0) |
420 | | void log_without_condition_check(util::source_info_view source, |
421 | | log_level level, fmt::format_string<Args...> format, |
422 | 8.71k | Args&&... args) const { |
423 | 8.71k | fmt::memory_buffer buffer; |
424 | 8.71k | fmt::format_to( |
425 | 8.71k | std::back_inserter(buffer), format, std::forward<Args>(args)...); |
426 | 8.71k | config_.sink().write(time_stamp::now(), tag_.name(), level, source, |
427 | 8.71k | std::string_view(buffer.data(), buffer.size())); |
428 | 8.71k | } _ZNK11num_collect7logging6logger27log_without_condition_checkIJRdEQgtsZT_Li0EEEvNS_4util16source_info_viewENS0_9log_levelEN3fmt3v1119basic_format_stringIcJDpNS8_13type_identityIT_E4typeEEEEDpOSB_ Line | Count | Source | 422 | 102 | Args&&... args) const { | 423 | 102 | fmt::memory_buffer buffer; | 424 | 102 | fmt::format_to( | 425 | 102 | std::back_inserter(buffer), format, std::forward<Args>(args)...); | 426 | 102 | config_.sink().write(time_stamp::now(), tag_.name(), level, source, | 427 | 102 | std::string_view(buffer.data(), buffer.size())); | 428 | 102 | } |
_ZNK11num_collect7logging6logger27log_without_condition_checkIJRKdEQgtsZT_Li0EEEvNS_4util16source_info_viewENS0_9log_levelEN3fmt3v1119basic_format_stringIcJDpNS9_13type_identityIT_E4typeEEEEDpOSC_ Line | Count | Source | 422 | 607 | Args&&... args) const { | 423 | 607 | fmt::memory_buffer buffer; | 424 | 607 | fmt::format_to( | 425 | 607 | std::back_inserter(buffer), format, std::forward<Args>(args)...); | 426 | 607 | config_.sink().write(time_stamp::now(), tag_.name(), level, source, | 427 | 607 | std::string_view(buffer.data(), buffer.size())); | 428 | 607 | } |
_ZNK11num_collect7logging6logger27log_without_condition_checkIJRddEQgtsZT_Li0EEEvNS_4util16source_info_viewENS0_9log_levelEN3fmt3v1119basic_format_stringIcJDpNS8_13type_identityIT_E4typeEEEEDpOSB_ Line | Count | Source | 422 | 2 | Args&&... args) const { | 423 | 2 | fmt::memory_buffer buffer; | 424 | 2 | fmt::format_to( | 425 | 2 | std::back_inserter(buffer), format, std::forward<Args>(args)...); | 426 | 2 | config_.sink().write(time_stamp::now(), tag_.name(), level, source, | 427 | 2 | std::string_view(buffer.data(), buffer.size())); | 428 | 2 | } |
_ZNK11num_collect7logging6logger27log_without_condition_checkIJRlRdEQgtsZT_Li0EEEvNS_4util16source_info_viewENS0_9log_levelEN3fmt3v1119basic_format_stringIcJDpNS9_13type_identityIT_E4typeEEEEDpOSC_ Line | Count | Source | 422 | 7.95k | Args&&... args) const { | 423 | 7.95k | fmt::memory_buffer buffer; | 424 | 7.95k | fmt::format_to( | 425 | 7.95k | std::back_inserter(buffer), format, std::forward<Args>(args)...); | 426 | 7.95k | config_.sink().write(time_stamp::now(), tag_.name(), level, source, | 427 | 7.95k | std::string_view(buffer.data(), buffer.size())); | 428 | 7.95k | } |
_ZNK11num_collect7logging6logger27log_without_condition_checkIJlEQgtsZT_Li0EEEvNS_4util16source_info_viewENS0_9log_levelEN3fmt3v1119basic_format_stringIcJDpNS7_13type_identityIT_E4typeEEEEDpOSA_ Line | Count | Source | 422 | 3 | Args&&... args) const { | 423 | 3 | fmt::memory_buffer buffer; | 424 | 3 | fmt::format_to( | 425 | 3 | std::back_inserter(buffer), format, std::forward<Args>(args)...); | 426 | 3 | config_.sink().write(time_stamp::now(), tag_.name(), level, source, | 427 | 3 | std::string_view(buffer.data(), buffer.size())); | 428 | 3 | } |
_ZNK11num_collect7logging6logger27log_without_condition_checkIJRlEQgtsZT_Li0EEEvNS_4util16source_info_viewENS0_9log_levelEN3fmt3v1119basic_format_stringIcJDpNS8_13type_identityIT_E4typeEEEEDpOSB_ Line | Count | Source | 422 | 6 | Args&&... args) const { | 423 | 6 | fmt::memory_buffer buffer; | 424 | 6 | fmt::format_to( | 425 | 6 | std::back_inserter(buffer), format, std::forward<Args>(args)...); | 426 | 6 | config_.sink().write(time_stamp::now(), tag_.name(), level, source, | 427 | 6 | std::string_view(buffer.data(), buffer.size())); | 428 | 6 | } |
_ZNK11num_collect7logging6logger27log_without_condition_checkIJRKlS4_S4_EQgtsZT_Li0EEEvNS_4util16source_info_viewENS0_9log_levelEN3fmt3v1119basic_format_stringIcJDpNS9_13type_identityIT_E4typeEEEEDpOSC_ Line | Count | Source | 422 | 12 | Args&&... args) const { | 423 | 12 | fmt::memory_buffer buffer; | 424 | 12 | fmt::format_to( | 425 | 12 | std::back_inserter(buffer), format, std::forward<Args>(args)...); | 426 | 12 | config_.sink().write(time_stamp::now(), tag_.name(), level, source, | 427 | 12 | std::string_view(buffer.data(), buffer.size())); | 428 | 12 | } |
_ZNK11num_collect7logging6logger27log_without_condition_checkIJRldEQgtsZT_Li0EEEvNS_4util16source_info_viewENS0_9log_levelEN3fmt3v1119basic_format_stringIcJDpNS8_13type_identityIT_E4typeEEEEDpOSB_ Line | Count | Source | 422 | 3 | Args&&... args) const { | 423 | 3 | fmt::memory_buffer buffer; | 424 | 3 | fmt::format_to( | 425 | 3 | std::back_inserter(buffer), format, std::forward<Args>(args)...); | 426 | 3 | config_.sink().write(time_stamp::now(), tag_.name(), level, source, | 427 | 3 | std::string_view(buffer.data(), buffer.size())); | 428 | 3 | } |
_ZNK11num_collect7logging6logger27log_without_condition_checkIJRKiEQgtsZT_Li0EEEvNS_4util16source_info_viewENS0_9log_levelEN3fmt3v1119basic_format_stringIcJDpNS9_13type_identityIT_E4typeEEEEDpOSC_ Line | Count | Source | 422 | 9 | Args&&... args) const { | 423 | 9 | fmt::memory_buffer buffer; | 424 | 9 | fmt::format_to( | 425 | 9 | std::back_inserter(buffer), format, std::forward<Args>(args)...); | 426 | 9 | config_.sink().write(time_stamp::now(), tag_.name(), level, source, | 427 | 9 | std::string_view(buffer.data(), buffer.size())); | 428 | 9 | } |
_ZNK11num_collect7logging6logger27log_without_condition_checkIJRKdS4_EQgtsZT_Li0EEEvNS_4util16source_info_viewENS0_9log_levelEN3fmt3v1119basic_format_stringIcJDpNS9_13type_identityIT_E4typeEEEEDpOSC_ Line | Count | Source | 422 | 21 | Args&&... args) const { | 423 | 21 | fmt::memory_buffer buffer; | 424 | 21 | fmt::format_to( | 425 | 21 | std::back_inserter(buffer), format, std::forward<Args>(args)...); | 426 | 21 | config_.sink().write(time_stamp::now(), tag_.name(), level, source, | 427 | 21 | std::string_view(buffer.data(), buffer.size())); | 428 | 21 | } |
|
429 | | |
430 | | private: |
431 | | //! Tag. |
432 | | log_tag tag_; |
433 | | |
434 | | //! Configuration. |
435 | | log_tag_config config_; |
436 | | |
437 | | //! Minimum log level to output always. |
438 | | log_level always_output_log_level_; |
439 | | |
440 | | //! Lowest log level to output. |
441 | | log_level lowest_output_log_level_; |
442 | | |
443 | | //! Handler of layers of iterations. |
444 | | impl::iteration_layer_handler iteration_layer_handler_{}; |
445 | | }; |
446 | | |
447 | | } // namespace num_collect::logging |