Introduced Logger.
[bpdyndnsd] / src / logger.cpp
CommitLineData
254bbf53
BS
1/** @file
2 * @brief Logger class implementation. This class implements the Logging facility.
3 *
4 *
5 *
6 * @copyright Intra2net AG
7 * @license GPLv2
8*/
9
10
11#include "logger.h"
12
13
14/**
15 * Default Constructor
16 */
17Logger::Logger()
18{
19 print_constructor_call("Logger");
20}
21
22
23/**
24 * Default Destructor
25 */
26Logger::~Logger()
27{
28 print_destructor_call("Logger");
29}
30
31
32/**
33 * Prints out the usage to the command line.
34 */
35void Logger::print_usage(const po::options_description* opt_desc)
36{
37 cout << "Usage: bpdyndnsd [Command line options]" << "\n" << endl;
38 cout << *opt_desc << endl;
39}
40
41
42/**
43 * Prints out the programm name and the given version string on stdout.
44 * @param version Version string.
45 */
46void Logger::print_version()
47{
48 ostringstream version_string;
49 version_string << VERSION << "." << REVISION << "." << RELEASE;
50 cout << "Bullet proof dynamic dns daemon.\nbpdyndnsd " << version_string.str() << endl;
51}
52
53
54/**
55 * Prints out the successful parsing of the command line options.
56 */
57void Logger::print_cmd_parsed()
58{
59 cout << "Command line options successfully parsed." << endl;
60}
61
62
63/**
64 * Prints out the successful parsing of the config files.
65 */
66void Logger::print_conf_loaded(const string& config_path)
67{
68 cout << "Config files successfully loaded in: " << config_path << endl;
69}
70
71
72/**
73 * Prints out the successful parsing of the config files.
74 */
75void Logger::print_conf_not_loaded(const string& config_path)
76{
77 cout << "Config files couldn't be loaded in: " << config_path << endl;
78}
79
80
81/**
82 * Prints out the detection of unknown option on config file.
83 */
84void Logger::print_unknown_conf_option()
85{
86 cout << "Unknown option in config file detected" << endl;
87 cout << "See manpage for config file structure." << endl;
88}
89
90
91/**
92 * Prints out error on opening file
93 */
94void Logger::print_error_opening(const string& filename)
95{
96 cout << "Error opening file for reading: " << filename << endl;
97}
98
99
100/**
101 * Desctructor of specified class was called.
102 * @param _class Name of the class.
103 */
104void Logger::print_destructor_call(const string& _class)
105{
106 cout << "Destructor call: " << _class << endl;
107}
108
109
110/**
111 * Constructor of specified class was called.
112 * @param _class Name of the class.
113 */
114void Logger::print_constructor_call(const string& _class)
115{
116 cout << "Constructor call: " << _class << endl;
117}
118
119
120/**
121 * Update method for specified service was called.
122 * @param service The service which for which is running the update.
123 */
124void Logger::print_update_service(const string& service)
125{
126 cout << "Running update for service: " << service << endl;
127}
128
129
130void Logger::print_unknown_cmd_option(const string& unknown_option)
131{
132 cout << "Unknown option on command line detected: " << unknown_option << endl;
133}
134
135
136void Logger::print_unknown_protocol(const string& protocol)
137{
138 cout << "Unknown protocol defined: " << protocol << endl;
139}
140
141
142void Logger::print_load_service_conf(const string& filename)
143{
144 cout << "Loading service config file: " << filename << endl;
145}
146
147
148void Logger::print_load_main_conf(const string& filename)
149{
150 cout << "Loading main config file: " << filename << endl;
151}
152
153
154void Logger::print_unknown_service_conf_option(const string& unknown_option)
155{
156 cout << "Unknown option in service config file detected: " << unknown_option << endl;
157}
158
159
160void Logger::print_unknown_main_conf_option(const string& unknown_option)
161{
162 cout << "Unknown option in mian config file detected: " << unknown_option << endl;
163}
164
165
166void Logger::print_error_config_path(const string& config_path)
167{
168 cout << "Config path doesn't exists or is not a diretory: " << config_path << endl;
169}
170
171
172void Logger::print_missing_cmd_service_option()
173{
174 cout << "Missing option to initialize service. Protocol, host, login and password must be specified." << endl;
175}