hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
logger_manager.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_SPDLOG_LOGGER_MANAGER_HPP
7 #define IROHA_SPDLOG_LOGGER_MANAGER_HPP
8 
10 
11 #include <memory>
12 #include <mutex>
13 #include <string>
14 #include <unordered_map>
15 
16 #include <boost/optional.hpp>
17 #include "logger/logger_spdlog.hpp"
18 
19 namespace logger {
20 
26  public:
27  explicit LoggerManagerTree(ConstLoggerConfigPtr config);
28 
29  explicit LoggerManagerTree(LoggerConfig config);
30 
40  LoggerManagerTreePtr registerChild(std::string tag,
41  boost::optional<LogLevel> log_level,
42  boost::optional<LogPatterns> patterns);
43 
46 
48  LoggerManagerTreePtr getChild(const std::string &tag);
49 
50  private:
51  LoggerManagerTree(std::string full_tag,
52  std::string node_tag,
53  ConstLoggerConfigPtr config);
54 
55  const std::string node_tag_;
56  const std::string full_tag_;
57  const ConstLoggerConfigPtr config_;
58  std::shared_ptr<Logger> logger_;
59  std::unordered_map<std::string, LoggerManagerTreePtr> children_;
60  std::mutex children_mutex_;
61  };
62 
63 } // namespace logger
64 
65 #endif // IROHA_SPDLOG_LOGGER_MANAGER_HPP
LoggerManagerTreePtr registerChild(std::string tag, boost::optional< LogLevel > log_level, boost::optional< LogPatterns > patterns)
Definition: logger_manager.cpp:33
Definition: logger_manager.hpp:25
LoggerManagerTree(ConstLoggerConfigPtr config)
Definition: logger_manager.cpp:20
std::shared_ptr< const LoggerConfig > ConstLoggerConfigPtr
Definition: logger_spdlog.hpp:24
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
LoggerPtr getLogger()
Get this node&#39;s logger. Thread safe.
Definition: logger_manager.cpp:52
LoggerManagerTreePtr getChild(const std::string &tag)
Get non-const child node by tag, if present. Thread safe.
Definition: logger_manager.cpp:71
Definition: dummy_logger.hpp:11
std::shared_ptr< LoggerManagerTree > LoggerManagerTreePtr
Definition: logger_manager_fwd.hpp:14
Definition: logger_spdlog.hpp:49