asr_util_logger  1.0.0
Config.h
[詳解]
1 #ifndef ASR_UTIL_LOGGER_CONFIG_H
2 #define ASR_UTIL_LOGGER_CONFIG_H
3 
4 #include <yaml-cpp/yaml.h>
5 
6 #include <istream>
7 #include <memory> // std::unique_ptr
8 #include <string>
9 #include <vector>
10 
11 namespace asr
12 {
13 namespace util
14 {
15 namespace logger
16 {
17 class Config
18 {
19 public:
20  struct Spdlog
21  {
22  struct Sink
23  {
24  std::string type;
25  std::string level;
26  std::unique_ptr<std::string> pattern;
27  std::unique_ptr<std::string> ident;
28 
29  Sink() = delete;
30  explicit Sink(const YAML::Node& node);
31  Sink(const Sink&) = delete;
32  Sink(Sink&& the_other) = default;
33  };
34 
35  std::string level;
36  std::string name;
37  std::vector<Sink> sinks;
38 
39  Spdlog() = delete;
40  explicit Spdlog(const YAML::Node& node);
41  };
42 
43  struct TopLevel
44  {
45  std::string logger;
46  std::unique_ptr<Spdlog> spdlog;
47 
48  TopLevel() = delete;
49  explicit TopLevel(const YAML::Node& node);
50  };
51 
52 private:
54 
55 public:
56  Config() = delete;
57  explicit Config(std::istream& the_istream);
58 
59  const TopLevel& data() const { return m_data; }
60 };
61 } // namespace logger
62 } // namespace util
63 } // namespace asr
64 
65 #endif // ASR_UTIL_LOGGER_CONFIG_H
TopLevel m_data
Definition: Config.h:53
std::string level
Definition: Config.h:25
std::string logger
Definition: Config.h:45
std::string level
Definition: Config.h:35
std::unique_ptr< Spdlog > spdlog
Definition: Config.h:46
Definition: Config.h:20
Definition: Config.h:11
std::unique_ptr< std::string > ident
Definition: Config.h:27
const TopLevel & data() const
Definition: Config.h:59
std::vector< Sink > sinks
Definition: Config.h:37
Definition: Config.h:17
std::unique_ptr< std::string > pattern
Definition: Config.h:26
std::string type
Definition: Config.h:24
std::string name
Definition: Config.h:36