numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
logging_mixin.h
Go to the documentation of this file.
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 */
20#pragma once
21
24
25namespace num_collect::logging {
26
33public:
39 explicit logging_mixin(log_tag_view tag) : logger_(tag) {}
40
46 [[nodiscard]] auto logger() const noexcept
47 -> const num_collect::logging::logger& {
48 return logger_;
49 }
50
56 [[nodiscard]] auto logger() noexcept -> num_collect::logging::logger& {
57 return logger_;
58 }
59
66 template <typename Child>
68 if constexpr (requires(Child& obj) { obj.logger(); }) {
69 this->logger().initialize_child_algorithm_logger(child.logger());
70 }
71 }
72
73private:
76};
77
78} // namespace num_collect::logging
Class of tags of logs without memory management.
Class of loggers.
Definition logger.h:145
Class to incorporate logging in algorithms.
void configure_child_algorithm_logger_if_exists(Child &child)
Configure a logger of a child algorithm if exists.
logging_mixin(log_tag_view tag)
Constructor.
auto logger() noexcept -> num_collect::logging::logger &
Access to the logger.
num_collect::logging::logger logger_
Logger.
auto logger() const noexcept -> const num_collect::logging::logger &
Access to the logger.
Definition of log_tag_view class.
Definition of logger class.
Namespace of num_collect source codes.