C++ Server-Side SDK
LaunchDarkly SDK
logging_builder.hpp
1 #pragma once
2 
3 #include <launchdarkly/config/shared/built/logging.hpp>
4 #include <launchdarkly/logging/log_backend.hpp>
5 
6 #include <variant>
7 
8 namespace launchdarkly::config::shared::builders {
9 
14  public:
18  class BasicLogging {
19  public:
20  BasicLogging();
21 
27  BasicLogging& Level(LogLevel level);
28 
39  BasicLogging& Tag(std::string name);
40 
41  private:
42  LogLevel level_;
43  std::string tag_;
44  friend class LoggingBuilder;
45  };
46 
47  class CustomLogging {
48  public:
55  CustomLogging& Backend(std::shared_ptr<ILogBackend> backend);
56 
57  private:
58  std::shared_ptr<ILogBackend> backend_;
59  friend class LoggingBuilder;
60  };
61 
62  class NoLogging {};
63 
64  using LoggingType = std::variant<BasicLogging, CustomLogging, NoLogging>;
65 
69  LoggingBuilder() = default;
70 
76 
82 
88 
105  LoggingBuilder& Logging(LoggingType logging);
106 
112  built::Logging Build() const;
113 
114  private:
115  LoggingType logging_;
116 };
117 
118 } // namespace launchdarkly::config::shared::builders
BasicLogging & Tag(std::string name)
Definition: logging_builder.cpp:57
BasicLogging & Level(LogLevel level)
Definition: logging_builder.cpp:51
CustomLogging & Backend(std::shared_ptr< ILogBackend > backend)
Definition: logging_builder.cpp:67
LoggingBuilder & Logging(LoggingType logging)
Definition: logging_builder.cpp:31
built::Logging Build() const
Definition: logging_builder.cpp:6