Commit | Line | Data |
---|---|---|
254bbf53 BS |
1 | /** @file |
2 | * @brief Logger class header. This class represents the Logging facility. | |
3 | * | |
4 | * | |
5 | * | |
6 | * @copyright Intra2net AG | |
7 | * @license GPLv2 | |
8 | */ | |
9 | ||
10 | #ifndef LOGGER_H | |
11 | #define LOGGER_H | |
12 | ||
88a594e8 | 13 | #include <string> |
7f3ced8c | 14 | |
88a594e8 BS |
15 | #include <boost/program_options.hpp> |
16 | #include <boost/shared_ptr.hpp> | |
27baf279 | 17 | |
254bbf53 BS |
18 | class Logger |
19 | { | |
88a594e8 | 20 | |
8bca3c5d | 21 | private: |
88a594e8 BS |
22 | |
23 | typedef boost::shared_ptr<boost::program_options::options_description> Options_descriptionPtr; | |
24 | ||
8bca3c5d BS |
25 | int Loglevel; |
26 | bool Syslog; | |
254bbf53 BS |
27 | |
28 | public: | |
29 | ||
88a594e8 BS |
30 | typedef boost::shared_ptr<Logger> Ptr; |
31 | ||
254bbf53 BS |
32 | Logger(); |
33 | ||
34 | ~Logger(); | |
35 | ||
b38684ce | 36 | void log_notice(const std::string&) const; |
59c8d63c | 37 | |
b38684ce | 38 | void log_warning(const std::string&) const; |
59c8d63c | 39 | |
b38684ce | 40 | void log_error(const std::string&) const; |
59c8d63c | 41 | |
8bca3c5d BS |
42 | void set_loglevel(const int); |
43 | ||
b38684ce | 44 | int get_loglevel() const; |
8bca3c5d BS |
45 | |
46 | void set_syslog(const bool); | |
47 | ||
b38684ce | 48 | bool get_syslog() const; |
8bca3c5d BS |
49 | |
50 | void set_log_facility(const int, const bool); | |
51 | ||
b38684ce | 52 | void print_usage(const Options_descriptionPtr) const; |
254bbf53 | 53 | |
b38684ce | 54 | void print_version() const; |
254bbf53 | 55 | |
b38684ce | 56 | void print_cmd_parsed() const; |
254bbf53 | 57 | |
b38684ce | 58 | void print_conf_files_parsed() const; |
667c672c | 59 | |
b38684ce | 60 | void print_destructor_call(const std::string&) const; |
254bbf53 | 61 | |
b38684ce | 62 | void print_constructor_call(const std::string&) const; |
254bbf53 | 63 | |
b38684ce | 64 | void print_update_service(const std::string&) const; |
254bbf53 | 65 | |
b38684ce | 66 | void print_unknown_cmd_option(const std::string&) const; |
254bbf53 | 67 | |
b38684ce | 68 | void print_unknown_protocol(const std::string&) const; |
254bbf53 | 69 | |
b38684ce | 70 | void print_load_service_conf(const std::string&) const; |
254bbf53 | 71 | |
b38684ce | 72 | void print_load_main_conf(const std::string&) const; |
254bbf53 | 73 | |
b38684ce | 74 | void print_unknown_service_conf_option(const std::string&) const; |
254bbf53 | 75 | |
b38684ce | 76 | void print_unknown_main_conf_option(const std::string&) const; |
254bbf53 | 77 | |
b38684ce | 78 | void print_error_opening_r(const std::string&) const; |
667c672c | 79 | |
b38684ce | 80 | void print_error_opening_rw(const std::string&) const; |
254bbf53 | 81 | |
b38684ce | 82 | void print_error_config_path(const std::string&) const; |
254bbf53 | 83 | |
b38684ce | 84 | void print_conf_loaded(const std::string&) const; |
254bbf53 | 85 | |
b38684ce | 86 | void print_conf_not_loaded(const std::string&) const; |
254bbf53 | 87 | |
b38684ce | 88 | void print_missing_cmd_service_option() const; |
388f4ab0 | 89 | |
b38684ce | 90 | void print_runnig_as_daemon(const int) const; |
388f4ab0 | 91 | |
b38684ce | 92 | void print_daemon_mode(const bool) const; |
388f4ab0 | 93 | |
b38684ce | 94 | void print_error_fork() const; |
388f4ab0 | 95 | |
b38684ce | 96 | void print_pid_found(const int) const; |
388f4ab0 | 97 | |
b38684ce | 98 | void print_process_already_running(const int) const; |
c5675c01 | 99 | |
b38684ce | 100 | void print_caught_sigterm() const; |
c5675c01 | 101 | |
b38684ce | 102 | void print_caught_siguser1() const; |
c5675c01 | 103 | |
b38684ce | 104 | void print_caught_sighup() const; |
8bca3c5d | 105 | |
b38684ce | 106 | void print_error_setting_signal(const std::string&) const; |
8bca3c5d | 107 | |
b38684ce | 108 | void print_init_log_facility() const; |
8bca3c5d | 109 | |
b38684ce | 110 | void print_offline_mode() const; |
27baf279 | 111 | |
b38684ce | 112 | void print_serialized_objects_success() const; |
27baf279 | 113 | |
b38684ce | 114 | void print_deserialized_objects_success() const; |
27baf279 | 115 | |
3c0cd271 | 116 | void print_service_object(const std::string&, const std::string&, const std::string&, const std::string&, const std::string&, const int, const int, const std::string&, std::list<int>*) const; |
5d38cfe6 | 117 | |
b38684ce | 118 | void print_exception_serialize(const std::string&) const; |
667c672c | 119 | |
b38684ce | 120 | void print_exception_deserialize(const std::string&) const; |
667c672c | 121 | |
b38684ce | 122 | void print_error_kill_child(const int) const; |
667c672c | 123 | |
b38684ce | 124 | void print_child_killed(const int) const; |
584b9407 | 125 | |
b38684ce | 126 | void print_no_object_file(const std::string&) const; |
0665b239 BS |
127 | |
128 | void print_hostname(const std::string&) const; | |
129 | ||
019dc0d9 BS |
130 | void print_own_ipv4(const std::string&) const; |
131 | ||
132 | void print_own_ipv6(const std::string&) const; | |
0665b239 BS |
133 | |
134 | void print_error_hostname_to_ip(const std::string&, const std::string&) const; | |
68c6b4af | 135 | |
1c0908b5 BS |
136 | void print_update_service_successful(const std::string&) const; |
137 | ||
138 | void print_webcheck_no_ip() const; | |
139 | ||
140 | void print_webcheck_url_connection_problem(const char *, const std::string&) const; | |
141 | ||
142 | void print_webcheck_error(const char *, const std::string&) const; | |
143 | ||
144 | void print_received_curl_data(const std::string&) const; | |
145 | ||
146 | void print_regex_found_ip(const std::string&) const; | |
147 | ||
148 | void print_regex_ip_not_found(const std::string&) const; | |
3c0cd271 BS |
149 | |
150 | void print_multiple_cmd_option(const std::string&) const; | |
151 | ||
152 | void print_update_not_allowed(const int current_time, const int old_time, const int MaxUpdatesWithinInterval, const std::string& service) const; | |
153 | ||
154 | void print_update_service_failure(const std::string& service) const; | |
254bbf53 BS |
155 | }; |
156 | ||
157 | #endif |