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 | ||
e8d4a6f8 | 36 | void log_notice(const std::string& msg) const; |
59c8d63c | 37 | |
e8d4a6f8 | 38 | void log_warning(const std::string& msg) const; |
59c8d63c | 39 | |
e8d4a6f8 | 40 | void log_error(const std::string& msg) const; |
59c8d63c | 41 | |
e8d4a6f8 | 42 | void set_loglevel(const int _loglevel); |
8bca3c5d | 43 | |
b38684ce | 44 | int get_loglevel() const; |
8bca3c5d | 45 | |
e8d4a6f8 | 46 | void set_syslog(const bool _syslog); |
8bca3c5d | 47 | |
b38684ce | 48 | bool get_syslog() const; |
8bca3c5d | 49 | |
e8d4a6f8 | 50 | void set_log_facility(const int _loglevel, const bool _syslog); |
8bca3c5d | 51 | |
e8d4a6f8 | 52 | void print_usage(const Options_descriptionPtr opt_desc) 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 | |
e8d4a6f8 | 60 | void print_destructor_call(const std::string& _class) const; |
254bbf53 | 61 | |
e8d4a6f8 | 62 | void print_constructor_call(const std::string& _class) const; |
254bbf53 | 63 | |
e8d4a6f8 | 64 | void print_update_service(const std::string& service) const; |
254bbf53 | 65 | |
e8d4a6f8 | 66 | void print_unknown_cmd_option(const std::string& unknown_option) const; |
254bbf53 | 67 | |
e8d4a6f8 | 68 | void print_unknown_protocol(const std::string& protocol) const; |
254bbf53 | 69 | |
e8d4a6f8 | 70 | void print_load_service_conf(const std::string& filename) const; |
254bbf53 | 71 | |
e8d4a6f8 | 72 | void print_load_main_conf(const std::string& filename) const; |
254bbf53 | 73 | |
8a00a649 | 74 | void print_unknown_service_conf_option(const std::string& service_conf_file, const std::string& unknown_option) const; |
254bbf53 | 75 | |
e8d4a6f8 | 76 | void print_unknown_main_conf_option(const std::string& unknown_option) const; |
254bbf53 | 77 | |
e8d4a6f8 | 78 | void print_error_opening_r(const std::string& filename) const; |
667c672c | 79 | |
e8d4a6f8 | 80 | void print_error_opening_rw(const std::string& filename) const; |
254bbf53 | 81 | |
e8d4a6f8 | 82 | void print_error_config_path(const std::string& config_path) const; |
254bbf53 | 83 | |
e8d4a6f8 | 84 | void print_conf_loaded(const std::string& config_path) const; |
254bbf53 | 85 | |
e8d4a6f8 | 86 | void print_conf_not_loaded(const std::string& config_path) const; |
254bbf53 | 87 | |
b38684ce | 88 | void print_missing_cmd_service_option() const; |
388f4ab0 | 89 | |
8a00a649 BS |
90 | void print_missing_service_conf_option(const std::string& service_conf_file) const; |
91 | ||
e8d4a6f8 | 92 | void print_runnig_as_daemon(const int pid) const; |
388f4ab0 | 93 | |
e8d4a6f8 | 94 | void print_daemon_mode(const bool daemon_mode) const; |
388f4ab0 | 95 | |
b38684ce | 96 | void print_error_fork() const; |
388f4ab0 | 97 | |
e8d4a6f8 | 98 | void print_pid_found(const int pid) const; |
388f4ab0 | 99 | |
e8d4a6f8 | 100 | void print_process_already_running(const int pid) const; |
c5675c01 | 101 | |
b38684ce | 102 | void print_caught_sigterm() const; |
c5675c01 | 103 | |
b38684ce | 104 | void print_caught_siguser1() const; |
c5675c01 | 105 | |
b38684ce | 106 | void print_caught_sighup() const; |
8bca3c5d | 107 | |
e8d4a6f8 | 108 | void print_error_setting_signal(const std::string& signal) const; |
8bca3c5d | 109 | |
b38684ce | 110 | void print_init_log_facility() const; |
8bca3c5d | 111 | |
b38684ce | 112 | void print_offline_mode() const; |
27baf279 | 113 | |
b38684ce | 114 | void print_serialized_objects_success() const; |
27baf279 | 115 | |
b38684ce | 116 | void print_deserialized_objects_success() const; |
27baf279 | 117 | |
e8d4a6f8 | 118 | void print_service_object(const std::string& message, const std::string& protocol, const std::string& hostname, const std::string& login, const std::string& password, const int update_interval, const int max_updates_within_interval, const std::string& actual_ip, std::list<int>* lastupdated) const; |
5d38cfe6 | 119 | |
e8d4a6f8 | 120 | void print_exception_serialize(const std::string& exception) const; |
667c672c | 121 | |
e8d4a6f8 | 122 | void print_exception_deserialize(const std::string& exception) const; |
667c672c | 123 | |
e8d4a6f8 | 124 | void print_error_kill_child(const int pid) const; |
667c672c | 125 | |
e8d4a6f8 | 126 | void print_child_killed(const int pid) const; |
584b9407 | 127 | |
e8d4a6f8 | 128 | void print_no_object_file(const std::string& object_file) const; |
0665b239 | 129 | |
e8d4a6f8 | 130 | void print_hostname(const std::string& hostname) const; |
0665b239 | 131 | |
c3dea5dc | 132 | void print_own_ipv4(const std::string& ip_addr_v4, const std::string& hostname) const; |
019dc0d9 | 133 | |
c3dea5dc | 134 | void print_own_ipv6(const std::string& ip_addr_v6, const std::string& hostname) const; |
0665b239 | 135 | |
e8d4a6f8 | 136 | void print_error_hostname_to_ip(const std::string& exception, const std::string& hostname) const; |
68c6b4af | 137 | |
e8d4a6f8 | 138 | void print_update_service_successful(const std::string& service) const; |
1c0908b5 BS |
139 | |
140 | void print_webcheck_no_ip() const; | |
141 | ||
e8d4a6f8 | 142 | void print_webcheck_url_connection_problem(const char * curl_err_buff, const std::string& url) const; |
1c0908b5 | 143 | |
e8d4a6f8 | 144 | void print_webcheck_error(const char * curl_err_buff, const std::string& url) const; |
1c0908b5 | 145 | |
e8d4a6f8 | 146 | void print_received_curl_data(const std::string& curl_data) const; |
1c0908b5 | 147 | |
e8d4a6f8 | 148 | void print_regex_found_ip(const std::string& ip) const; |
1c0908b5 | 149 | |
e8d4a6f8 | 150 | void print_regex_ip_not_found(const std::string& data) const; |
3c0cd271 | 151 | |
e8d4a6f8 | 152 | void print_multiple_cmd_option(const std::string& message) const; |
3c0cd271 | 153 | |
8a00a649 BS |
154 | void print_multiple_service_conf_option(const std::string& service_conf_file, const std::string& message) const; |
155 | ||
156 | void print_multiple_main_conf_option(const std::string& main_conf_file, const std::string& message) const; | |
157 | ||
3c0cd271 BS |
158 | void print_update_not_allowed(const int current_time, const int old_time, const int MaxUpdatesWithinInterval, const std::string& service) const; |
159 | ||
160 | void print_update_service_failure(const std::string& service) const; | |
e304c27b BS |
161 | |
162 | void print_starting_shutdown() const; | |
163 | ||
164 | void print_shutdown_succeeded() const; | |
165 | ||
166 | void print_shutdown_parent_succeeded() const; | |
167 | ||
168 | void print_starting_shutdown_parent() const; | |
0541cd71 BS |
169 | |
170 | void print_recheck_dns_entry(const std::string& hostname, const int lastupdated, const int dns_cache_ttl, const int current_time) const; | |
171 | ||
172 | void print_cached_dns_entry(const std::string& hostname, const std::string& cached_dns_entry, const std::string& lastupdated_ip) const; | |
8a00a649 BS |
173 | |
174 | void print_missing_cmd_proxy_option() const; | |
175 | ||
176 | void print_missing_conf_proxy_option(const std::string& main_conf_filename) const; | |
254bbf53 BS |
177 | }; |
178 | ||
179 | #endif |