Kallisto Linux API
Library for interacting with Kallisto devices
logger_configuration.hpp
Go to the documentation of this file.
1 
42 #ifndef LOGGER_CONFIGURATION_HPP_
43 #define LOGGER_CONFIGURATION_HPP_
44 
45 #include <string>
46 #include <memory>
47 
48 namespace kallisto {
49 namespace log {
50 
60 class LoggerConfiguration {
61 public:
65  //TODO Add VERBOSE level
66  enum class LogLevel {
67  TRACE = 2,
68  DEBUG,
69  INFO,
70  WARNING,
71  ERROR,
72  NONE
73  };
74 
75 private:
77  LogLevel m_log_level; //Log level
78 
80  bool m_log_to_file; //Signals if log messages should be saved to a file
81 
83  std::string m_log_file_folder; //Signals the folder where to save the log files
84 
86  LoggerConfiguration(LogLevel level, bool to_file, std::string to_file_folder);
87 
88 public:
92  ~LoggerConfiguration();
93 
97  LoggerConfiguration(const LoggerConfiguration& configuration);
98 
102  LoggerConfiguration& operator=(const LoggerConfiguration& configuration);
103 
107  LoggerConfiguration(LoggerConfiguration&& configuration);
108 
112  LoggerConfiguration& operator=(LoggerConfiguration&& configuration);
113 
119  LogLevel getLogLevel() const;
120 
126  bool getLogToFile() const;
127 
133  std::string getFileLogFolder() const;
134 
135  class Builder {
136  private:
138  LogLevel log_level = LogLevel::TRACE; //Log level
139 
141  bool log_to_file = false; //File sink
142 
143 //TODO Check this!
144 //#if _LINUX
145  std::string log_file_folder = "~/.kallisto/log"; //File sink folder
146 //#endif
147 
151  Builder(Builder const&) = delete;
152  Builder(Builder&&) = delete;
153  void operator=(Builder const&) = delete;
154  void operator=(Builder &&) = delete;
155 
156  public:
160  Builder();
161 
165  ~Builder();
166 
177  Builder& withLogLevel(LogLevel level);
178 
187  Builder& toFile();
188 
194  Builder& toFile(std::string path);
195 
201  LoggerConfiguration build();
202 
219  LoggerConfiguration buildDefault();
220  };
221 
222 };
223 
224 } /* namespace log */
225 } /* namespace kallisto */
226 
227 #endif /* LOGGER_CONFIGURATION_HPP_ */
Definition: bluetooth_adapter.hpp:52