Phoxonics  1.0
Object Oriented FDTD Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
SingleLoggerConfig.hpp
Go to the documentation of this file.
1 /*
2  * LoggerStaticConfig.hpp
3  *
4  * Created on: Jul 6, 2014
5  * Author: nano
6  */
7 
8 #ifndef SINGLELOGGERCONFIG_HPP_
9 #define SINGLELOGGERCONFIG_HPP_
10 
11 #include <string>
12 
13 namespace phoxonics {
14 namespace common {
15 
16 // Singleton the right way in c++
18 public:
20  {
21  // Guaranteed to be destroyed.
22  // Instantiated on first use.
24  return instance;
25  }
26 
27  // getters
28  std::string log_file_path() { return this->log_file_path_; }
29  bool log_to_console() { return this->log_to_console_; }
30  std::string show_log_level() { return this->show_log_level_; }
31 
32  // setters
33  void log_file_path(std::string value) { this->log_file_path_ = value; }
34  void log_to_console(bool value) { this->log_to_console_ = value; }
35  void show_log_level(std::string value) { this->show_log_level_ = value; }
36 
37 private:
38  // Constructor? (the {} brackets) are needed here.
39  inline SingleLoggerConfig() { };
40 
41  // Dont forget to declare these two. You want to make sure they
42  // are unaccessable otherwise you may accidently get copies of
43  // your singleton appearing.
44  SingleLoggerConfig(SingleLoggerConfig const&); // Don't Implement
45  void operator=(SingleLoggerConfig const&); // Don't implement
46 
47  std::string log_file_path_ { "" };
48  bool log_to_console_ { false };
49  std::string show_log_level_ { "" };
50 };
51 
52 }
53 }
54 
55 #endif /* SINGLELOGGERCONFIG_HPP_ */
std::string show_log_level()
Definition: SingleLoggerConfig.hpp:30
Definition: CommonBase.hpp:14
std::string log_file_path()
Definition: SingleLoggerConfig.hpp:28
static SingleLoggerConfig & instance()
Definition: SingleLoggerConfig.hpp:19
Definition: SingleLoggerConfig.hpp:17
bool log_to_console()
Definition: SingleLoggerConfig.hpp:29
void show_log_level(std::string value)
Definition: SingleLoggerConfig.hpp:35
void log_to_console(bool value)
Definition: SingleLoggerConfig.hpp:34
void log_file_path(std::string value)
Definition: SingleLoggerConfig.hpp:33